-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty response body when Content-Length and Transfer-Encoding headers are omitted #475
Comments
Content-Length
and Transfer-Encoding
headers are omittedContent-Length
and Transfer-Encoding
headers are omitted
This is a breaking bug for us, we've had to pin our hackney at an old version to mitigate it. |
Content-Length
and Transfer-Encoding
headers are omitted
I just ran into this issue also with |
@jknipp good catch! Is the server sending an HTTP 1.0 response ? 1.1 normally expects to have a content length. Can you check it? I propose indeed to fix it by checking if the client receive an http 1.0 response and then read until a max. Thoughts? |
@benoitc: Unfortunately, a lot of the internet doesn't follow specifications (HTTP 1.1 or otherwise). It would be beneficial for a client library to be as flexible as possible in this regard. The spec actually doesn't require Content-length to be set. Instead, if the header is not sent, then the client must close the connection after it is completed. See the spec: https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4
|
this is only for backward compatibility. I will only set a max to receive then. Fix release will land today.
…Sent from my iPhone
On 27 Feb 2018, at 01:12, Anil Kulkarni ***@***.***> wrote:
@benoitc: Unfortunately, a lot of the internet doesn't follow specifications (HTTP 1.1 or otherwise). It would be beneficial for a client library to be as flexible as possible in this regard.
The spec actually doesn't require Content-length to be set. Instead, if the header is not sent, then the client must close the connection after it is completed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
The server is following the spec, as @AnilRedshift said a missing content-length is valid and closing the connection will signal the end of the response body. |
well the server should do its best to send a content-length. I will fix it anyway. |
this change handle the case where no content-length and transfer-encoding headers are given in the response. The spec says we should try to read it. fix #475
can you test #481 ? It shoudl fix your issue. Let me know :) |
Hi, I just tested. Value in response is correct, but the whole response is returned as an "error response". I use email decryptor service, so body returned is an email. My tests are in Elixir IEx. Response from
Response from
Response from
Response from
As you may see, the value is correct, but returns in error response. |
@PatNowak do you have a link I could test by chance? Can be done in private if you want to |
It was url from private network, so it will not work for you. I can try to find an example that will be available publicly :) Edit: Sorry, I didn't find an example in public network :/ |
bump. |
@benoitc, in the meantime, would you please retract the package from Hex? |
@filmor Only mix has this feature. Anyway did you test the PR, it would help to have some feedback... |
I think you can ping the hex admins (support@hex.pm), I'll test the PR on Monday. |
@filmor ping? |
when the connection is closed but buffer not empty, return and OK result. fix #475
when the connection is closed but buffer not empty, return and OK result. fix #475
fix return for empty content length when the connection is closed but buffer not empty, return and OK result. fix #475
Beginning with v1.11.0, if the response from the server omits both the
Content-Length
andTransfer-Encoding
response headers, the body of the response is not parsed and returned.v1.11.0 Response Body
v1.10.1 Response Body
I believe the bug was introduced with the change in #450 to handle empty/invalid content-length.
5b51fb8#diff-03059c69a9df088e2476724af69f06bdL334
The text was updated successfully, but these errors were encountered: