I have a situation where I have some code running locally that has to communicate with another device on the same network. To do so, I'm making a straight http request to
http://192.168.0.1, a request that returns a bunch of data in the response body. The problem I'm having is that the device itself returns invalid headers:
HTTP/1.1 200 OK
Date: Wed, 02 Dec 2015 16:42:45 GMT
Server: nostradamus 1.9.5
Connection: close
Etag: Aug 28 2015, 07:57:20
Transfer-Encoding: chunked
HTTP/1.0 200 OK
Content-Type: text/html
Note the duplicate "HTTP/1.0 200 OK" header. Other tools (e.g. Chrome, curl, python) that I've tried at least handle the bad headers "gracefully", but node simply dies with a HPE_INVALID_HEADER_TOKEN error. It's not incorrect, of course, but I need a workaround. My code will be installed on hundreds of thousands of desktops talking to hundreds of thousands of these devices. We simply can't update all of the devices to fix the headers.
All I care about is the response body. Is there any way to get node to be more lenient and ignore the bad header? Do I have any options here?
Any thoughts would be much appreciated. I'm completely stuck here.