[PATCH 1 of 1 v2] serve: use chunked encoding in hgweb responses

Thomas Arendsen Hein thomas at intevation.de
Tue Jan 15 09:44:25 CST 2013


* Mads Kiilerich <mads at kiilerich.com> [20130114 00:07]:
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1358116000 -3600
> # Node ID cc9c9033808f0fef919a2326be26e0db9592c469
> # Parent  b37663b0f4a8106f60c13d229a34b442cf81ba11
> serve: use chunked encoding in hgweb responses

After this patch (cf5c76017e11 in crew) I get:

$ ./hg serve
192.168.11.35 - - [15/Jan/2013 16:39:02] "GET /static/hglogo.png HTTP/1.1" 304 -
----------------------------------------
Exception happened during processing of request from ('192.168.11.35', 46429)
Traceback (most recent call last):
  File "/usr/lib/python2.6/SocketServer.py", line 560, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.6/SocketServer.py", line 322, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/home/thomas/hg/repos/tah/mercurial/hgweb/server.py", line 48, in __init__
    BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kargs)
  File "/usr/lib/python2.6/SocketServer.py", line 617, in __init__
    self.handle()
  File "/usr/lib/python2.6/BaseHTTPServer.py", line 331, in handle
    self.handle_one_request()
  File "/usr/lib/python2.6/BaseHTTPServer.py", line 312, in handle_one_request
    self.raw_requestline = self.rfile.readline()
  File "/usr/lib/python2.6/socket.py", line 444, in readline
    data = self._sock.recv(self._rbufsize)
error: [Errno 104] Connection reset by peer
----------------------------------------

when using Firefox 18 and doing a simple reload. When doing a full
reload (shift-reload) the error does not appear.

http request with simple reload:

GET /static/hglogo.png HTTP/1.1
Host: host.example.com:port
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20130110 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en,de;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://host.example.com:port/
Connection: keep-alive
If-None-Match: 1358263473.31
Cache-Control: max-age=0

http reply with simple reload:

HTTP/1.1 304 Not Modified
Server: BaseHTTP/0.3 Python/2.6.6
Date: Tue, 15 Jan 2013 15:31:55 GMT
Transfer-Encoding: chunked

http request with forced reload:

GET /static/hglogo.png HTTP/1.1
Host: host.example.com:port
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20130110 Firefox/18.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en,de;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://host.example.com:port/
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

http reply with forced reload:

HTTP/1.1 200 Script output follows
Server: BaseHTTP/0.3 Python/2.6.6
Date: Tue, 15 Jan 2013 15:32:00 GMT
ETag: 1358263473.31
Content-Type: image/png
Content-Length: 4123

<89>PNG
...


I haven't tried this with a real webserver.

Regards,
Thomas

-- 
thomas at intevation.de - http://intevation.de/~thomas/ - OpenPGP key: 0x5816791A
Intevation GmbH, Neuer Graben 17, 49074 Osnabrueck - AG Osnabrueck, HR B 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner


More information about the Mercurial-devel mailing list