What does this error mean: HPE_INVALID_CONSTANT?
The HPE_INVALID_CONSTANT
means Http Parse Error
and the invalid constant means that the response is malformed. So the parser can't parse it!
I encountered this issue because I was trying to compress files that were too small. In my specific case, I was creating a readstream of a file that was 83 bytes, and then piping it into a gzip, before finally piping it into the response
fs.createReadStream(file_path).pipe(gzip.createGzip()).pipe(res);
On the requester side, I was then trying to unzip the file
stream = request({"url": "https://example.com/getFile", "timeout": 200000});
//This is where the error was getting thrown
stream.pipe(gzip.createGunzip())
It seems that trying to compress and then decompress a file with a size somewhere less than 200 bytes will totally break this, so that was a gotcha I encountered. I guess the moral of my story is don't compress files that are super tiny!
Think this answer is lated, but it can help some people.
I also had this problem and realized NodeJS doesn't support HTTP 0.9, that server's response contains no headers. In fact, in NodeJS documentation shows support to 1.0 and 1.1 http requests.
You can read a little more here in this issue.