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
{{ message }}
Repository navigation
urllib3 wrong computation of 'Content-Length' for file upload #76570
Hi! This is my first posting ever on this site. I need to upload a simple text file to Internet servers. With "curl" the operation goes smoothly, both with http and https protocols, both up/downloads. With urllib3 and other TCP-IP handlers the generated header for 'Content-Length' contains a wrong file length indication (log verification with TCPDUMP), the file is not uploaded, the servers return different error messages.
On the contrary, urllib3 file downloads do work, also with authentication.
In addition, in the documentation I still haven't figured out what 'whatfile' (or any of the other keywords used there) actually is. Is this a keyword (where is the list of all allowed kwds?), the source file, the target file, or what else?? How does the function behaviour change depending on that indication?
Yes, this would appear to be both 3rd party and a support request rather than a bug report. Gianguido: please work with the urllib3 community, or post to the python-list mailing list. If you identify an actual bug in Python itself, you can come back here to report it.
Activity
gianguido commentedon Dec 20, 2017
Hi! This is my first posting ever on this site. I need to upload a simple text file to Internet servers. With "curl" the operation goes smoothly, both with http and https protocols, both up/downloads. With urllib3 and other TCP-IP handlers the generated header for 'Content-Length' contains a wrong file length indication (log verification with TCPDUMP), the file is not uploaded, the servers return different error messages.
On the contrary, urllib3 file downloads do work, also with authentication.
code example
headers = {'authorization': 'Basic ==codeduserpwd=='}
resp = http_client.request('PUT',
'https://webserver.com',
headers=headers,
fields={'whatfile': (filename, file_data)}
)
In addition, in the documentation I still haven't figured out what 'whatfile' (or any of the other keywords used there) actually is. Is this a keyword (where is the list of all allowed kwds?), the source file, the target file, or what else?? How does the function behaviour change depending on that indication?
Thankful for your support!
asvetlov commentedon Dec 20, 2017
Is your question about urllib3?
This bug tracker is about python itself.
urllbib3 should be discussed here: https://github.com/shazow/urllib3
bitdancer commentedon Dec 20, 2017
Yes, this would appear to be both 3rd party and a support request rather than a bug report. Gianguido: please work with the urllib3 community, or post to the python-list mailing list. If you identify an actual bug in Python itself, you can come back here to report it.