镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

http: http_parser_llhttp regression #28137

Description

@ronag

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();
  });
});

Activity

  1. mscdex commented on Jun 8, 2019

    @mscdex
    Contributor

    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.

  2. ronag commented on Jun 8, 2019

    @ronag
    MemberAuthor

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

  3. ronag commented on Jun 8, 2019

    @ronag
    MemberAuthor

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

  4. mscdex commented on Jun 8, 2019

    @mscdex
    Contributor

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

  5. indutny commented on Jun 9, 2019

    @indutny
    Member

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

  6. added
    httpIssues and PRs related to the http subsystem.
    http_parserIssues and PRs related to the HTTP parser implementation or http_parser binding.
    on Jun 9, 2019
  7. indutny commented on Jun 10, 2019

    @indutny
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpIssues and PRs related to the http subsystem.http_parserIssues and PRs related to the HTTP parser implementation or http_parser binding.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions