[issue38330] httplib specifies content-length when transfer-encoding present

apmatthews report at bugs.python.org
Mon Sep 30 16:24:01 EDT 2019


New submission from apmatthews <apmatthews at gmail.com>:

RFC 7230 3.3.2 states "A sender MUST NOT send a Content-Length header field in any message that contains a Transfer-Encoding header field."

When trying to perform a chunked request:

import httplib
http = httplib.HTTPSConnection('google.com')
http.request("POST", '/', None, {'Content-Type': 'text/plain',
                                 'Transfer-Encoding': 'chunked'})

Resulting headers include:

Content-Length: 0
Transfer-Encoding: chunked

The receiving server should ignore the Content-Length in this case but some versions of IIS don't and consequently fail to accept the chunks that follow.

----------
components: Library (Lib)
messages: 353617
nosy: apmatthews
priority: normal
severity: normal
status: open
title: httplib specifies content-length when transfer-encoding present
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38330>
_______________________________________


More information about the Python-bugs-list mailing list