The simplest web server in python (python2.7, windows10):

 python -mSimpleHTTPServer 

Gives static files. curl shows that the HTTP/1.0 protocol is being used (which corresponds to the HTTPServer documentation):

 curl -s -D - http://localhost:8000/foo.jpg -o nul HTTP/1.0 200 OK Server: SimpleHTTP/0.6 Python/2.7.11 Date: Sun, 07 Aug 2016 07:21:20 GMT Content-type: image/jpeg Content-Length: 25803 Last-Modified: Thu, 30 Jun 2016 06:13:58 GMT 

At the same time, when requested through a browser (Crome, Firefox), HTTP/1.1 obtained (visible through the developer console, on the network tab):

 HTTP/1.1 200 OK Server: SimpleHTTP/0.6 Python/2.7.11 Date: Sun, 07 Aug 2016 07:21:42 GMT Content-type: image/jpeg Content-Length: 25803 Last-Modified: Thu, 30 Jun 2016 06:13:58 GMT 

Accordingly, the browser does not close the connection after the request.

In both cases, the output using print in the BaseHTTPServer.py source shows the first line of the client request as GET /foo.jpg HTTP/1.1 . In the answer in both cases (also in print in the server code) the first line: HTTP/1.0 200 OK .

Proxy server is not used.

If you request from a browser from a virtual machine, the http version does not change ( HTTP/1.0 remains).

What could be the reason for this difference?

  • Proxy server is not configured? Check your browser settings. - Pavel Mayorov
  • @PavelMayorov did not use a proxy, now checked just in case again - Vladimir Gamalyan
  • The browser itself chooses 1.1 or 1.0 to use - eri
  • @andreymal with the installation went or installed later, lies in C:\Python27\Lib\site-packages\http\client.py - Vladimir Gamalyan
  • @VladimirGamalian is somehow very, very, very strange, because in the second python it must be a module SimpleHTTPServer (he deleted his comment by negligence, but he never found the http.server module) - Aug

1 answer 1

The culprit was ESET Smart Security 9. As it turned out, shutting down via Приостановить работу файервола (разрешить весь трафик) was not enough. An option was found in the detailed settings:

picture

When disabled, the protocol stopped transforming into http1.1.

  • one
    Vladimir, if you are interested in trying to answer you, I asked a similar question on SO and received a comprehensive answer on this topic. Stackoverflow.com/q/38813071/4569475 - Dmitry Petukhov
  • @DmitryPetukhov aha, read, thanks! - Vladimir Gamalyan
  • one
    @DmitryPetukhov you have a different question: your client sends an http / 1.1 request, and the server returns an http / 1.0 answer (in the log you have a client request, not the answer). Here, it seems that the eset program is silently squeezed between the browser and the server (as a proxy) and therefore the browser sees the http / 1.1 response ( http.server returns http / 1.0 in all the cases considered) - jfs