-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
auth and data set results in invalid http header #3066
Comments
Yup, this is a real bug. |
Working out exactly how best to fix this is tricky: |
Ok, I think the best way to do this is to have |
In fact, we maybe want to go higher level than that: perhaps |
@Lukasa has anyone started work on this? I have some free time today, I was thinking I'd take a look at it. If I come up with something I can put together a PR. |
@davidsoncasey I don't believe anyone has taken this up yet, no. |
@Lukasa great, I'm working now on writing a test to replicate the issue. Once I've got that, I may ask you to take a look to verify that I'm correctly capturing the issue, and then I'll proceed with a fix. |
…ng' headers are being set in PreparedRequest. Refs psf#3066.
…der has already been set. Refs psf#3066.
@Lukasa I just made PR #3181, with the solution to not call I was thinking it may be more clear to refactor |
…epare_content_length. This allows for the 'Content-Length' header to only be set in prepare_content_length. References psf#3066.
…ng' headers are being set in PreparedRequest. Refs psf#3066.
…epare_content_length. This allows for the 'Content-Length' header to only be set in prepare_content_length. References psf#3066.
…epare_content_length. This allows for the 'Content-Length' header to only be set in prepare_content_length. References psf#3066.
I had a brief chat about this issue with @Lukasa this morning, and wanted to update the status. Due to some recent improvements to f = io.BytesIO(b'')
resp = requests.put('http://httpbin.org/put', auth=('asdf', 'fdsa'), data=f)
assert 'Transfer-Encoding' in resp.request.headers
assert 'Content-Length' not in resp.request.headers
@davidsoncasey, you've done a lot of great work in #3184 and #3338 that would be beneficial for Requests. Would you be willing to reframe a few parts of it around these recent changes?
How does that sound? |
…ng' headers are being set in PreparedRequest. Refs psf#3066.
…epare_content_length. This allows for the 'Content-Length' header to only be set in prepare_content_length. References psf#3066.
…ng' headers are being set in PreparedRequest. Refs psf#3066.
The move of streamable bodies of length 0 to |
Yep, I realized what a rats nest that was going to be when I started digging yesterday. I guess I should have paid more attention to jseabold's work before extending it. Disregard my comment on that above. |
This should be resolved with #3754. |
https://stackoverflow.com/questions/36216274/uploading-a-0-bytes-file-to-owncloud-with-python-requests-hangs/36217781#36217781
When auth is set and a file object is passed to data, the header contains a content-length AND a Transfer-Encoding: chunked is set in the header and additionally the last chunk is not send.
The text was updated successfully, but these errors were encountered: