Skip to content

[linux-armv7l] http.request() fails with HPE_INVALID_CONSTANT error  #37053

Description

@Chaphasilor
  • Version: tested on Node v14.15.4, v15.6.0 and v14.7.x
  • Platform: Linux 5.4.51-v7l+ armv7l GNU/Linux (it's a Raspberry Pi 4 running Debian 10)
  • Subsystem: http

What steps will reproduce the bug?

Run the following:

consthttp=require(`http`)consturl=`http://51.77.66.14/Trilogia%20%20John%20Wick%202014-2019%20REMUX%204K%20HDR%20Latino/John%20Wick%203%20Parabellum%202019%20REMUX%204K%20HDR%20Latino.mkv`constbyteOffset=2595000000constreq=http.request(url,{method: `GET`,headers: {'Range': `bytes=${byteOffset}-`,}},(res)=>{console.log(`STATUS:`,res.statusCode);console.log(`HEADERS:`,res.headers);// res.setEncoding('hex');res.on('data',(chunk)=>{// needs to be registered so that the body is parsed});})req.on('error',(err)=>{console.error(err)});req.end();

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

One this platform, always.

What is the expected behavior?

No error, the response should be parsed just fine. I know the responding web server might be (at least partially) at fault, but the issue does not appear on win32 (Windows 10) or in Linux/WSL1 (openSUSE & Debian) on x64, so this probably isn't desired behavior.

For what it's worth, both curl and wget don't face this issue either.

What do you see instead?

STATUS: 206
HEADERS: {date: 'Sun, 24 Jan 2021 18:03:49 GMT',server: 'Apache/2.4.29 (Ubuntu)','last-modified': 'Sun, 05 Jan 2020 20:21:31 GMT',etag: '"f9ac35f5c-59b6a49dd4bc5"','accept-ranges': 'bytes','content-length': '64426004636','content-range': 'bytes 2595000000-67021004635/67021004636',connection: 'close','content-type': 'video/x-matroska'}
Error: Parse Error: ExpectedHTTP/atSocket.socketOnData(_http_client.js:509:22)atSocket.emit(events.js:315:20)ataddChunk(internal/streams/readable.js:309:12)atreadableAddChunk(internal/streams/readable.js:284:9)atSocket.Readable.push(internal/streams/readable.js:223:10)atTCP.onStreamRead(internal/stream_base_commons.js:188:23){bytesParsed: 335,code: 'HPE_INVALID_CONSTANT',reason: 'Expected HTTP/',rawPacket: <Buffer9a40a41b3baa46a57ee709dd353f9e93b6bc753e04acdce6f8cd99c47f07980ce7f9c32ce8d220ffd0989848c0ef0766605d...1350morebytes>}

Additional information

The requested file is quite large, so if it doesn't throw an error after a few seconds, don't wait for it to finish. I wish I had another URL to shared, but right now I only have this one. Although I am very sure I've encountered this error several times before (but didn't look into it further).

Also, notice the byteOffset. The issue happens at a specific byte range, hence the offset. The offset isn't totally exact, but should narrow it down to a few megabytes...

I really hope someone can figure out what's going on here. I'm building a download manager and it's very unfortunate that it doesn't work reliably on my server...

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.http_parserIssues and PRs related to the HTTP Parser dependency or the http_parser binding.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions