httpful
httpful copied to clipboard
HTTP Header parsing is inconsistent
The parsing of a HTTP response headers diverges between Response::_parseHeaders
and Response\Headers::fromString
.
fromString
just parses the header lines and overwrites multiple header line with the same header names, whereas _parseHeaders
references RFC2616 Sec 4.2 and concatenates multiple headers to a comma-separated list.
A possible solution would be to move the code of _parseHeaders
to fromString
and let _parseHeaders
call fromString
.
Ironically, my main reason for starting to use an http client library instead of raw curl commands was to get consistent header parsing, so I was kind of surprised to encounter this issue that it overwrites multiple headers with the same name. +1 to this PR.