In ``Lib/distutils/command/register.py`` as well as ``upload.py``, the following code exists to build the HTTP request body to send to the cheese shop server: body.write('\nContent-Disposition: form-data; name="%s"'%key) body.write("\n\n") RFC2616 page 31 (http://tools.ietf.org/html/rfc2616#page-31) states that headers must be separated by CRLF. Specifically, the above "\n\n" for the header separator is causing issues with some minimal RFC-compliant web servers.
Hi Mitchell, thanks for your interest in Python. Using CLRF was requested before (#10510) and rejected on the ground that the RFC (at least for HTTP 1.0) allows LF. CRLF is preferred but not required. Hence, we deem it is not a bug. The register, upload and upload_docs commands in distutils2 do use CRLF. BTW, I think your patch was incomplete: You stripped one newline, replaced one LF with CRLF, and left many other LFs.
http://tools.ietf.org/html/rfc2616#section-3.7.1 > When in canonical form, media subtypes of the "text" type use CRLF as > the text line break. HTTP relaxes this requirement and allows the > transport of text media with plain CR or LF alone representing a line > break when it is done consistently for an entire entity-body. HTTP > applications MUST accept CRLF, bare CR, and bare LF as being > representative of a line break in text media received via HTTP
The requests we send are multipart/form-data, so the RFC exception for text/* would not apply. I’m closing this bug as a duplicate and will ask on the other one if we should reopen it.