Consolidate duplicate content-length response headers #435
Description
While deploying Envoy, which uses this project for parsing HTTP/1.1 messages, we've seen an occasional bug in a web service where the health-check response contains duplicate content-length
headers, looking like:
< HTTP/1.1 200 OK
--
< Content-Length: 0
< Content-Length: 0
<
This library considers the duplicate content-length
headers erroneous (code), and as a result Envoy fails the health-check and won't route traffic to that host. Per RFC 7230, Section 3.3.2, if the values of duplicate content-length headers are equivalent, it is acceptable to either reject the message or consolidate the values into a single content-length
header.
This issue is a proposal to implement the latter - if the duplicate content-length headers are found to contain the same value, consolidate them into a single content-length
header to improve robustness.