Return a duplex stream b from a request url req.url.
You should pipe an http request into b and pipe b into an http response,
like this:
http.createServer(function (req, res) {
var b = backend(req.url);
req.pipe(b).pipe(res);
})
If you pass in a cb, it will register an errback for the 'service' and
'error' events.
var sb = b.createBand()
Return a writable side-band stream sb.
For info actions, you can write a response back to the user with this stream.
events
b.on('service', function (service) {})
When the service header metadata has been parsed, this event fires. service is
a stream that outputs the request stream data from the remote git endpoint and
expects the git-{receive,upload}-pack data as input. You should wire up the
service has these handy properties:
service.cmd - the git command name string
service.args - the arguments array that the git command expects
service.action - the type of request: 'info', 'tag', 'push', or
'pull'
service.fields - the field data associated with the request action type
service.type - the content-type you should send for the response. Some git
clients will not work if the proper content-type header hasn't been sent.
For 'info' actions, the service.fields is an empty object {}.
For 'pull' actions, the service.fields are:
service.fields.head - the commit hash of the requested HEAD
For 'push' actions, the service.fields are:
service.fields.last - the last commit in the commit payload range
service.fields.head - the first commit in the commit payload range
service.fields.branch - the branch name
For 'tag' actions, the service.fields are:
service.fields.last - the last commit in the commit payload range
service.fields.head - the first commit in the commit payload range
请发表评论