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: http_parser_llhttp regression #28137

Closed
ronag opened this issue Jun 8, 2019 · 6 comments
Closed

http: http_parser_llhttp regression #28137

ronag opened this issue Jun 8, 2019 · 6 comments
Labels
http_parser Issues and PRs related to the HTTP Parser dependency or the http_parser binding. http Issues or PRs related to the http subsystem.

Comments

@ronag
Copy link
Member

ronag commented Jun 8, 2019

Based on test-http-response-status-message.js.

This will succeed with --http-parser legacy but fail otherwise.

Related #27984 (comment), #28120

'use strict';
const common = require('../common');
const http = require('http');
const net = require('net');

const server = net.createServer(function(con) {
  con.on('data', function(data) {
    con.write('HTTP/1.1 200\r\n\r\n');
    con.end();
  });
});

server.listen(0, function() {
  http.get({
    port: server.address().port
  }, function(res) {
    res.on('aborted', common.mustNotCall());
    res.on('end', common.mustCall());
    res.resume();
  });
});
@mscdex
Copy link
Contributor

mscdex commented Jun 8, 2019

I believe the newer parser is more correct. From RFC 7230:

status-line = HTTP-version SP status-code SP reason-phrase CRLF

reason-phrase = *( HTAB / SP / VCHAR / obs-text )

So you can have an empty reason-phrase, but you still need at least the space before it.

@ronag
Copy link
Member Author

ronag commented Jun 8, 2019

@mscdex so I guess the tests need to be updated?

@ronag
Copy link
Member Author

ronag commented Jun 8, 2019

con.write('HTTP/1.1 200 OK\r\n\r\n'); will also fail

@mscdex
Copy link
Contributor

mscdex commented Jun 8, 2019

An issue should be posted to https://github.com/nodejs/llhttp/issues then.

@indutny
Copy link
Member

indutny commented Jun 9, 2019

This should fix it: https://github.com/nodejs/llhttp/pull/26/files . Sorry if it caused a disruption!

@lpinca lpinca added http Issues or PRs related to the http subsystem. http_parser Issues and PRs related to the HTTP Parser dependency or the http_parser binding. labels Jun 9, 2019
@indutny
Copy link
Member

indutny commented Jun 10, 2019

The fix has been landed and released. Here is a PR to update llhttp: #28154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http_parser Issues and PRs related to the HTTP Parser dependency or the http_parser binding. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

No branches or pull requests

4 participants