automatic gzip fix

This commit is contained in:
Ian McLeod 2017-06-11 21:03:53 -05:00
parent 5a106c6c93
commit d6b96a2bf2
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From cf3b26b84a186fe7f5f4ccba8daa69b38a822807 Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <puiterwijk@redhat.com>
Date: Tue, 23 May 2017 14:57:01 +0200
Subject: [PATCH] Prevent automatic gzip decompression by unsetting
Accept-Encoding
By not setting Accept-Encoding, servers will send Content-Type: x-gzip, which prevents
urllib3 (on behalf of requests) from decompressing it.
Fixes: #237
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
---
oz/ozutil.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/oz/ozutil.py b/oz/ozutil.py
index 7c75dc5..039c5a5 100644
--- a/oz/ozutil.py
+++ b/oz/ozutil.py
@@ -834,7 +834,8 @@ def http_download_file(url, fd, show_progress, logger):
"""
with requests.Session() as requests_session:
requests_session.mount('file://', LocalFileAdapter())
- response = requests_session.get(url, stream=True, allow_redirects=True)
+ response = requests_session.get(url, stream=True, allow_redirects=True,
+ headers={'Accept-Encoding': ''})
file_size = int(response.headers.get('Content-Length'))
chunk_size = 10*1024*1024
done = 0

View File

@ -1,7 +1,7 @@
Summary: Library and utilities for automated guest OS installs
Name: oz
Version: 0.15.0
Release: 6%{?dist}
Release: 7%{?dist}
License: LGPLv2
Group: Development/Libraries
URL: http://github.com/clalancette/oz
@ -9,6 +9,7 @@ Source0: http://github.com/clalancette/%{name}/files/150178/%{name}-%{version}.t
Patch0: oz-secondaryarch.patch
Patch1: 32a4edd3124e7acb2dac02ff77aeea944313cbc2.patch
Patch2: 11c32a684b20b92f800d3ffa670dc8773e22bb92.patch
Patch3: 0238-Prevent-automatic-gzip-decompression.patch
BuildArch: noarch
Requires: python >= 2.5
Requires: python-libguestfs >= 1.18
@ -38,6 +39,7 @@ installations, with minimal input from the user.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
python setup.py build
@ -85,6 +87,10 @@ fi
%{_mandir}/man1/*
%changelog
* Fri Jun 09 2017 Brendan Reilly <breilly@redhat.com> - 0.15.0-7
- Add patch to prevent automatic gzip decompression
- Pulled from upstream https://github.com/clalancette/oz/pull/238
* Wed May 10 2017 Brendan Reilly <breilly@redhat.com> - 0.15.0-6
- Add patch to use openssl instead of nss
- Pulled from upstream https://github.com/clalancette/oz/pull/231