Ask questionsHPE_INVALID_HEADER_TOKEN on http requests

Upgrading to 12.2.0 broke several http calls with a parse error HPE_INVALID_HEADER_TOKEN, all requests were working fine with version 11.10.0 I had before the upgrade.

I tried http-parser-js library to patch http but I still get the same issue process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;


Answer questions mscdex

@jd4ever That response is malformed. According to the http spec, spaces are not permitted in header field names. So this is a case of the old http parser being less strict than the new http parser that's on by default in node v12.

You can still use the old http parser for now in node v12 by passing --http-parser=legacy to your node command line.


Related questions

Crash with "req.handle.writev is not a function" on Socket.Writable.uncork hot 2
--max-http-header-size= is not allowed in NODE_OPTIONS hot 2
Assertion `(parser->current_buffer_len_) == (0)' failed hot 1
pkg-exports: "." errors without a specified `main` hot 1
shutdown ENOTCONN on TLS.Socket._final hot 1
Node.js 12.10 throwing EPROTO on HTTPS request hot 1
Remove util.inherits usage internally? hot 1
[Bug] Node 10.1.0 TLS issue with ldap: Client network socket disconnected before secure TLS connection was established hot 1
ReferenceError: internalBinding is not defined hot 1
HTTP/2 requests eventually start throwing NGHTTP2_ENHANCE_YOUR_CALM errors hot 1
Incorrect timezone hot 1
crypto, bad decrypt hot 1
stream.finished behaviour change hot 1
display node.js version (process.version) at the end of stacktraces hot 1 is very slow hot 1
Github User Rank List