[PATCH 12 of 12] serve: don't close connections with chunked encoding

Augie Fackler raf at durin42.com
Mon Jan 14 13:43:38 CST 2013


On Sat, Jan 12, 2013 at 12:32:56AM +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski at unity3d.com>
> # Date 1357947110 -3600
> # Node ID c554ae0503419c8c5fc2a888da9ed48afda451a8
> # Parent  d4104616205bc3d9fa665a6cae85bc702774987c
> serve: don't close connections with chunked encoding
>
> Problem:
> The WSGI server/middleware tried to be smart and both observe and control
> data flow and connection lifetime ... but it wasn't smart enough and didn't
> forward transfer encodings and connection state correctly.
>
> Solution:
> Drop code that didn't work and tried to do things it shouldn't try to do. 'hg
> serve' will now trust the WSGI app more and control less.  As a consequence of
> this http connections will often be kept alive longer.
>
> diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
> --- a/mercurial/hgweb/server.py
> +++ b/mercurial/hgweb/server.py
> @@ -151,6 +151,9 @@
>              if h[0].lower() == 'content-length':
>                  should_close = False
>                  self.length = int(h[1])
> +            elif (h[0].lower() == 'transfer-encoding' and
> +                  h[1].lower() == 'chunked'):
> +                should_close = False
>          # The value of the Connection header is a list of case-insensitive
>          # tokens separated by commas and optional whitespace.
>          if should_close:
> diff --git a/tests/test-https.t b/tests/test-https.t
> --- a/tests/test-https.t
> +++ b/tests/test-https.t

This change fixes these fingerprint warnings? Really? how?

> @@ -124,7 +124,6 @@
>    adding manifests
>    adding file changes
>    added 1 changesets with 4 changes to 4 files
> -  warning: localhost certificate with fingerprint 91:4f:1a:ff:87:24:9c:09:b6:85:9b:88:b1:90:6d:30:75:64:91:ca not verified (check hostfingerprints or web.cacerts config setting)
>    updating to branch default
>    4 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    $ hg verify -R copy-pull
> @@ -152,7 +151,6 @@
>    adding manifests
>    adding file changes
>    added 1 changesets with 1 changes to 1 files
> -  warning: localhost certificate with fingerprint 91:4f:1a:ff:87:24:9c:09:b6:85:9b:88:b1:90:6d:30:75:64:91:ca not verified (check hostfingerprints or web.cacerts config setting)
>    changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=https://localhost:$HGPORT/
>    (run 'hg update' to get a working copy)
>    $ cd ..
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list