[Python-ideas] why is not request in httplib pretty printed?

Terry Reedy tjreedy at udel.edu
Sat Dec 7 00:07:42 CET 2013


On 12/6/2013 5:09 PM, Matěj Cepl wrote:

> http://hg.python.org/cpython/file/543c76769c14/Lib/http/client.py#l847
> (but this code has been same since like forever) I see that the
> HTTP request is NOT pretty printed:
>
>       if self.debuglevel > 0:
>           print("send:", repr(data))
>
> whereas response in effect (because every header is printed
> separately) is.

Some thing have just not been done yet.


> Wouldn't it be better to pretty print the
> request as well?

> Otherwise I get quite unreadable debugging logs like the
> following (notice how much response is more readable than
> request).

> matej at wycliff: urllib2_kerberos (next *%)$ python test_trac.py
> send: 'GET /desktopqe-backlog/login HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: someserver.redhat.com\r\nConnection: close\r\nUser-Agent: Python-urllib/2.7\r\n\r\n'

I agree that the request above should be as nicely printed as the 
response below. If there is not already a tracker issue for this, I 
think you should open one.

> reply: 'HTTP/1.1 401 Authorization Required\r\n'
> header: Date: Fri, 06 Dec 2013 17:11:13 GMT
> header: Server: Apache

-- 
Terry Jan Reedy




More information about the Python-ideas mailing list