Skip to content

urllib3 wrong computation of 'Content-Length' for file upload #76570

Closed

Description

@gianguido
mannequin
BPO 32389
Nosy @bitdancer, @asvetlov

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2017-12-20.18:59:15.431>
created_at = <Date 2017-12-20.18:15:40.144>
labels = ['type-bug', 'library']
title = "urllib3 wrong computation of 'Content-Length' for file upload"
updated_at = <Date 2017-12-20.18:59:15.429>
user = 'https://bugs.python.org/gianguido'

bugs.python.org fields:

activity = <Date 2017-12-20.18:59:15.429>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2017-12-20.18:59:15.431>
closer = 'r.david.murray'
components = ['Library (Lib)']
creation = <Date 2017-12-20.18:15:40.144>
creator = 'gianguido'
dependencies = []
files = []
hgrepos = []
issue_num = 32389
keywords = []
message_count = 3.0
messages = ['308761', '308767', '308774']
nosy_count = 3.0
nosy_names = ['r.david.murray', 'asvetlov', 'gianguido']
pr_nums = []
priority = 'normal'
resolution = 'third party'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue32389'
versions = []

Activity

  1. gianguido commented on Dec 20, 2017

    gianguidomannequin
    MannequinAuthor

    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!

  2. added
    stdlib
    type-bug
    on Dec 20, 2017
  3. asvetlov commented on Dec 20, 2017

    @asvetlov
    Contributor

    Is your question about urllib3?
    This bug tracker is about python itself.
    urllbib3 should be discussed here: https://github.com/shazow/urllib3

  4. bitdancer commented on Dec 20, 2017

    @bitdancer
    Member

    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.

  5. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions