Can urllib2 request HTTP / 1.1?

EDIT:

This question is not valid. It turns out the transparent proxy made an HTTP 1.0 request, although urllib / httplib did an HTTP 1.1 request.

ORIGINAL QUESTION:

By default, it urllib2.urlopenalways makes an HTTP 1.0 request.

Is there any way to make it speak HTTP 1.1?

+3
source share
2 answers

Why do you think it is not using http 1.1 yet? Have you tried something like ...:

>>> import urllib2
>>> urllib2._opener.handlers[1].set_http_debuglevel(100)
>>> urllib2.urlopen('http://mit.edu').read()[:10]
connect: (mit.edu, 80)
send: 'GET / HTTP/1.1

(etc.)? This should show that it is sending a 1.1 GET request already.

+12
source

urllib2 httplib HTTP-. Python 2.6.4 HTTP/1.1 httplib, 1.1, 1.0 0.9. 2.3, , -, (, , 1.5)

, -, :

CONNECT host:port HTTP/1.0

/1.0 .

python , urllib2?

+3

Source: https://habr.com/ru/post/1724637/


All Articles