Message315787
Consider the following script:
try:
from urllib import request
except ImportError:
import urllib2 as request
handler = request.HTTPSHandler(debuglevel=1)
opener = request.build_opener(handler)
f = opener.open('https://httpbin.org/user-agent')
In python2.x this works:
$ python2 http_client_bug.py
send: 'GET /user-agent HTTP/1.1\r\nAccept-Encoding: identity\r\nHost:
httpbin.org\r\nConnection: close\r\nUser-Agent: Python-urllib/2.7\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Connection: close
header: Server: gunicorn/19.7.1
header: Date: Thu, 26 Apr 2018 12:01:35 GMT
header: Content-Type: application/json
header: Access-Control-Allow-Origin: *
header: Access-Control-Allow-Credentials: true
header: X-Powered-By: Flask
header: X-Processed-Time: 0
header: Content-Length: 40
header: Via: 1.1 vegur
But in python3.x only the header keys are printed. Not the values (also a newline after each header will be nice):
$ python3 http_client_bug.py
send: b'GET /user-agent HTTP/1.1\r\nAccept-Encoding: identity\r\nHost:
httpbin.org\r\nUser-Agent: Python-urllib/3.6\r\nConnection: close\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Connection header: Server header: Date header: Content-Type
header: Access-Control-Allow-Origin header:
Access-Control-Allow-Credentials header: X-Powered-By header:
X-Processed-Time header: Content-Length header:
Patch for this is attached. |
|
Date |
User |
Action |
Args |
2018-04-26 12:12:56 | mstrigl | set | recipients:
+ mstrigl |
2018-04-26 12:12:56 | mstrigl | set | messageid: <1524744776.83.0.682650639539.issue33365@psf.upfronthosting.co.za> |
2018-04-26 12:12:56 | mstrigl | link | issue33365 messages |
2018-04-26 12:12:56 | mstrigl | create | |
|