Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http: regression in Upgrade header handling #627

Closed
bnoordhuis opened this issue Jan 27, 2015 · 6 comments
Closed

http: regression in Upgrade header handling #627

bnoordhuis opened this issue Jan 27, 2015 · 6 comments
Labels
confirmed-bug Issues with confirmed bugs. http Issues or PRs related to the http subsystem.

Comments

@bnoordhuis
Copy link
Member

'use strict';

var assert = require('assert');
var http = require('http');
var net = require('net');

var seenUpgrade = 0;
process.on('exit', function() { assert.equal(seenUpgrade, 1); });

http.createServer(assert.fail).listen(0, '127.0.0.1', function() {
  this.on('upgrade', function(req, conn, head) {
    seenUpgrade += 1;
    conn.destroy();
    this.close();
  });
  var options = { host: this.address().address, port: this.address().port };
  net.connect(options, function() {
    this.write('GET / HTTP/1.1\r\n' +
               'Upgrade: Yes, please.\r\n' +
               '\r\n');
  });
});

Works with joyent/node@v0.11.16 but fails with iojs@5843ae8. The request callback is called and the 'upgrade' event doesn't fire. I'll bisect.

@bnoordhuis bnoordhuis added confirmed-bug Issues with confirmed bugs. http Issues or PRs related to the http subsystem. labels Jan 27, 2015
@bnoordhuis
Copy link
Member Author

git-bisect has spoken:

598efcbe7f4d795622f038e0ba28c7b119927a14 is the first bad commit
commit 598efcbe7f4d795622f038e0ba28c7b119927a14
Author: Fedor Indutny <fedor@indutny.com>
Date:   Wed Jan 14 16:00:26 2015 +0300

    deps: update http_parser to 2.4.1

    PR-URL: https://github.com/iojs/io.js/pull/397
    Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

I blame the reviewer.

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Jan 28, 2015
Commit 598efcb ("deps: update http_parser to 2.4.1") introduced a
regression in HTTP Upgrade header handling.

Fixes: nodejs#627
PR-URL: nodejs#628
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Jan 28, 2015
Add a regression test for nodejs#627.

Before the http_parser rollback to 2.3.0, the request callback was
called but an 'upgrade' event was not emitted, even though there is
an Upgrade header present in the request.

PR-URL: nodejs#628
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
@bnoordhuis
Copy link
Member Author

Fixed in 6605096.

@indutny indutny reopened this Apr 21, 2015
@indutny
Copy link
Member

indutny commented Apr 21, 2015

I think that the test case needs some justification. Why should this behavior be supported, who does experience the problems with it, and why shouldn't that code be fixed instead?

cc @bnoordhuis

@indutny
Copy link
Member

indutny commented Apr 21, 2015

(See nodejs/http-parser#237 for compromise solution, but let's discuss it first)

@Fishrock123
Copy link
Contributor

@indutny this is in master from http-parser@2.5.0 right?

@indutny
Copy link
Member

indutny commented May 15, 2015

Oh right!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants