notgiorgi notgiorgi - 4 days ago 6
HTTP Question

HTTP/0.9 Support in nodejs

I'm sending requests from NodeJs to legacy server, which uses

HTTP/0.9
. Response comes and throws an error:
Parse Error
. Couldn't find anything in docs about HTTP protocol support. Am I doing something wrong or NodeJS doesn't support
HTTP/0.9
?

Answer

Node does not support HTTP/0.9 not only because it's hardly in use anymore, but because real HTTP/0.9 responses just consist of response data. That means that there is no status line indicating the response's HTTP version, so there is no way to differentiate an HTTP/0.9 response from either a malformed HTTP/1.x response or even an HTTP/0.9 response that starts with the string "HTTP/1.1 200 OK\r\n".

Comments