vapor/http

Satisfy HTTP/1.1 requirement of 'Host' header in client requests in HTTPClient

givip opened this issue · 1 comments

givip commented

Version: 3.0.0-rc.2.3.1

I founded a bug, when some virtual hosted websites responds with 400 http code error while interacted via HTTPClient (NIO implementation).
After some investigation I've figured out, that Host header is required https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23

Also, about header Content-Length discussion needed, because in my opinion It's not always needed https://stackoverflow.com/a/8540951
https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4

And while initializing HTTPRequest Content-Length will be fulfilled in any case.

Merged the PR, thanks!