Skip to content

Unexpected HTTP Parse Error #34350

@szmarczak

Description

@szmarczak

What steps will reproduce the bug?

https://runkit.com/szmarczak/5f0d0b92c01e77001bd2be09

const https = require('https');

https.request('https://www.sachadrake.com/images/assetimages/social_media_default.jpg', {
    method: 'HEAD'
}, response => {
    console.log(response.statusCode);
}).end();

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior?

404

What do you see instead?

404
Error {
	bytesParsed: 478
	code: "HPE_INVALID_CONSTANT"
	rawPacket: Buffer <48, 54, 54, 50, 2F, 31, 2E, 31, 20, 34, 30, 34, 20, 4E, 6F, 74, 20, 46, 6F, 75, 6E, 64, 0D, 0A, 43, 6F, …>
	reason: "Expected HTTP/"
	message: "Parse Error: Expected HTTP/"
}

Additional information

The server replies with these data:

HTTP/1.1 404 Not Found
Content-Type: text/html
Server: 
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: NOSNIFF
X-XSS-Protection: 1
Content-Security-Policy: default-src  * 'unsafe-inline' 'unsafe-eval' ; img-src * data: 'unsafe-inline' ; font-src * data: 'unsafe-inline' ; media-src * blob: 'unsafe-inline' ; frame-src * data: 'unsafe-inline' 'unsafe-eval' ;
Date: Tue, 14 Jul 2020 01:35:23 GMT
Strict-Transport-Security: max-age=3600
Transfer-Encoding: chunked

/cc @Kikobeats

Metadata

Metadata

Assignees

No one assigned

    Labels

    httpIssues or PRs related to the http subsystem.http_parserIssues and PRs related to the HTTP Parser dependency or the http_parser binding.wontfixIssues that will not be fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions