var req = parser.incoming;
- // This is start + byteParsed + 1 due to the error of getting \n
- // in the upgradeHead from the closing lines of the headers
- var upgradeHead = d.slice(start + bytesParsed + 1, end);
+ // This is start + byteParsed
+ var upgradeHead = d.slice(start + bytesParsed, end);
if (self.listeners('upgrade').length) {
self.emit('upgrade', req, req.socket, upgradeHead);
assert(socket._httpMessage);
socket._httpMessage.res = res;
- // This is start + byteParsed + 1 due to the error of getting \n
- // in the upgradeHead from the closing lines of the headers
- var upgradeHead = d.slice(start + bytesParsed + 1, end);
+ // This is start + byteParsed
+ var upgradeHead = d.slice(start + bytesParsed, end);
// Make sure we don't try to send HTTP requests to it.
self._removeSocket(socket);
var res = parser.incoming;
req.res = res;
- // This is start + byteParsed + 1 due to the error of getting \n
- // in the upgradeHead from the closing lines of the headers
- var upgradeHead = d.slice(start + bytesParsed + 1, end);
+ // This is start + byteParsed
+ var upgradeHead = d.slice(start + bytesParsed, end);
if (req.listeners('upgrade').length) {
// Emit 'upgrade' on the Agent.
req.upgraded = true;
var req = parser.incoming;
- // This is start + byteParsed + 1 due to the error of getting \n
- // in the upgradeHead from the closing lines of the headers
- var upgradeHead = d.slice(start + bytesParsed + 1, end);
+ // This is start + byteParsed
+ var upgradeHead = d.slice(start + bytesParsed, end);
if (self.listeners('upgrade').length) {
self.emit('upgrade', req, req.socket, upgradeHead);
callbacks++;
};
-parser.onPath = function(b, off, length) {
- console.log('path [' + off + ', ' + length + ']');
- var path = b.toString('ascii', off, off + length);
- console.log('path = "' + path + '"');
- assert.equal('/hello', path);
- callbacks++;
-};
-
parser.execute(buffer, 0, request.length);
-assert.equal(4, callbacks);
+assert.equal(3, callbacks);
//
// Check that if we throw an error in the callbacks that error will be