You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am seeing an issue where the Content-Length header is being repeated when making real network requests with the EM-HTTP-Request library. Here is the scenario:
I wrote a test that replicates the issue here if helpful
I think this boils down to the WebMock::RequestSignature#headers= where we call WebMock::Util::Headers.normalize_headers(headers) and that changes the case of the headers.
Filing this because this presents an issue with Puma > 5.6.2 since they are now checking for invalid headers (see this line) and the Content-Length header that results here looks like Content-Length: 123, 123 which Puma rejects
This monkey patch appears to fix the issue:
module EventMachine
class WebMockHttpClient
def connection_completed
@state = :response_header
headers = request_signature.headers.inject({}) { |h, (k, v)| h[k.to_s.downcase] = v; h }
send_request(headers, request_signature.body)
end
end
end
The text was updated successfully, but these errors were encountered:
Hi there,
I am seeing an issue where the
Content-Length
header is being repeated when making real network requests with the EM-HTTP-Request library. Here is the scenario:I wrote a test that replicates the issue here if helpful
I think this boils down to the
WebMock::RequestSignature#headers=
where we callWebMock::Util::Headers.normalize_headers(headers)
and that changes the case of the headers.However in https://github.com/igrigorik/em-http-request/blob/master/lib/em-http/client.rb#L185, EventMachine assumes the request headers are downcased when attempting to assign a
Content-Length
, so we end up with both an capitalized and downcased version in the request headers.Filing this because this presents an issue with Puma > 5.6.2 since they are now checking for invalid headers (see this line) and the
Content-Length
header that results here looks likeContent-Length: 123, 123
which Puma rejectsThis monkey patch appears to fix the issue:
The text was updated successfully, but these errors were encountered: