why is not request in httplib pretty printed?

Hi, looking at 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. 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). Matěj matej@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' reply: 'HTTP/1.1 401 Authorization Required\r\n' header: Date: Fri, 06 Dec 2013 17:11:13 GMT header: Server: Apache header: WWW-Authenticate: Negotiate header: WWW-Authenticate: Basic realm="Kerberos Login" header: Content-Length: 483 header: Connection: close header: Content-Type: text/html; charset=iso-8859-1 2013-12-06 18:11:15,406 DEBUG inside http_error_401 2013-12-06 18:11:15,407 DEBUG retry count: 1 2013-12-06 18:11:15,407 DEBUG req.get_host() returned someserver.redhat.com 2013-12-06 18:11:15,407 DEBUG authGSSClientInit() succeeded 2013-12-06 18:11:15,486 DEBUG authGSSClientStep() succeeded 2013-12-06 18:11:15,486 DEBUG authGSSClientResponse() succeeded send: 'GET /desktopqe-backlog/login HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: someserver.redhat.com\r\nConnection: close\r\nAuthorization: Negotiate YIICdQYJKoZIhvcSA---some-junk--GZDggzt\r\nUser-Agent: Python-urllib/2.7\r\n\r\n' reply: 'HTTP/1.1 302 Found\r\n' header: Date: Fri, 06 Dec 2013 17:11:14 GMT header: Server: Apache header: WWW-Authenticate: Negotiate YIGZBgkqhkiG9xIB--other-junk--NOxMdOR/5 header: Location: https://someserver.redhat.com/desktopqe-backlog header: Content-Length: 0 header: Pragma: no-cache header: Cache-Control: no-cache header: Expires: Fri, 01 Jan 1999 00:00:00 GMT header: Set-Cookie: trac_auth=148d029eb321e9a0782fd30ca3f9d17b; Path=/desktopqe-backlog; secure header: Connection: close header: Content-Type: text/plain; charset=UTF-8 send: 'GET /desktopqe-backlog 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' reply: 'HTTP/1.1 200 OK\r\n' header: Date: Fri, 06 Dec 2013 17:11:15 GMT header: Server: Apache header: Cache-Control: must-revalidate header: Expires: Fri, 01 Jan 1999 00:00:00 GMT header: Content-Length: 9591 header: Set-Cookie: trac_form_token=a6eda80ba3f4ead82093a0af; Path=/desktopqe-backlog; secure header: Set-Cookie: trac_session=213441ab7934999739979a04; expires=Thu, 06-Mar-2014 17:11:15 GMT; Path=/desktopqe-backlog; secure header: Connection: close header: Content-Type: text/html;charset=utf-8 2013-12-06 18:11:17,190 DEBUG www-authenticate header not found 2013-12-06 18:11:17,190 CRITICAL mutual auth failed. No negotiate header matej@wycliff: urllib2_kerberos (next *%)$

On 12/6/2013 5:09 PM, Matěj Cepl wrote:
Some thing have just not been done yet.
Wouldn't it be better to pretty print the request as well?
matej@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.
-- Terry Jan Reedy

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I haven't found anything, so I have filed http://bugs.python.org/issue19917 Matěj -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iD8DBQFSovx64J/vJdlkhKwRAlXjAJ42kfsxMbP+TIzwBjqAQFqhEQP08wCeM8Aa IzhfXXl+iYjyRKKk/mWTir0= =DdfB -----END PGP SIGNATURE-----

On 12/6/2013 5:09 PM, Matěj Cepl wrote:
Some thing have just not been done yet.
Wouldn't it be better to pretty print the request as well?
matej@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.
-- Terry Jan Reedy

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I haven't found anything, so I have filed http://bugs.python.org/issue19917 Matěj -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iD8DBQFSovx64J/vJdlkhKwRAlXjAJ42kfsxMbP+TIzwBjqAQFqhEQP08wCeM8Aa IzhfXXl+iYjyRKKk/mWTir0= =DdfB -----END PGP SIGNATURE-----
participants (2)
-
Matěj Cepl
-
Terry Reedy