From 6ba8bba4f41ca9a2a4f7568ad45cabd41d7c9964 Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Tue, 12 Apr 2016 15:40:38 +0200 Subject: [PATCH] Fix hang on Gzip decompression 'LimitedInputFilter' should be applied before the Gzip middleware as 'CONTENT_LENGTH' refers to the size of the *compressed* body. If applied in wrong order, this may cause 'copyfileobj()' to try to read more data from the socket than is available, resulting in a call to 'recv()' that hangs forever. --- dulwich/web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dulwich/web.py b/dulwich/web.py index a4fa941..d8863fe 100644 --- a/dulwich/web.py +++ b/dulwich/web.py @@ -415,7 +415,7 @@ def make_wsgi_chain(*args, **kwargs): correctly wrapped with needed middleware. """ app = HTTPGitApplication(*args, **kwargs) - wrapped_app = GunzipFilter(LimitedInputFilter(app)) + wrapped_app = LimitedInputFilter(GunzipFilter(app)) return wrapped_app