From f439ffedeb9db3c2c86fc0be15037497d3075a3f Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Feb 08 2013 22:59:36 +0000 Subject: Fix a problem with cookie handling + https://bugzilla.redhat.com/show_bug.cgi?id=906924 --- diff --git a/python-requests-cookie-handling.patch b/python-requests-cookie-handling.patch new file mode 100644 index 0000000..e4bde77 --- /dev/null +++ b/python-requests-cookie-handling.patch @@ -0,0 +1,32 @@ +From 2cecc4bc828fc1754cc26f279ec3ff5cd65cb8f7 Mon Sep 17 00:00:00 2001 +From: Ralph Bean +Date: Thu, 31 Jan 2013 21:38:58 -0500 +Subject: [PATCH] cookie handling + +--- + requests/models.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +Index: requests-0.13.1/requests/models.py +=================================================================== +--- requests-0.13.1.orig/requests/models.py ++++ requests-0.13.1/requests/models.py +@@ -16,7 +16,7 @@ from .structures import CaseInsensitiveD + from .status_codes import codes + + from .auth import HTTPBasicAuth, HTTPProxyAuth +-from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header ++from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header, RequestsCookieJar + from .packages.urllib3.exceptions import MaxRetryError, LocationParseError + from .packages.urllib3.exceptions import SSLError as _SSLError + from .packages.urllib3.exceptions import HTTPError as _HTTPError +@@ -201,7 +201,8 @@ class Request(object): + extract_cookies_to_jar(self.cookies, self, resp) + + # Save cookies in Response. +- response.cookies = self.cookies ++ response.cookies = RequestsCookieJar() ++ extract_cookies_to_jar(response.cookies, self, resp) + + # Save cookies in Session. + for cookie in self.cookies: diff --git a/python-requests.spec b/python-requests.spec index aa9afd4..a028fdb 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -1,4 +1,4 @@ -%if 0%{?fedora} > 12 || 0%{?rhel} > 6 +%if 0%{?fedora} %global _with_python3 1 %else %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} @@ -6,15 +6,17 @@ Name: python-requests Version: 0.13.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: HTTP library, written in Python, for human beings License: ISC and MIT URL: http://pypi.python.org/pypi/requests Source0: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz - +# Separate response cookies from request cookies discussed here: +# https://github.com/fedora-infra/python-fedora/pull/6 +Patch0: python-requests-cookie-handling.patch BuildArch: noarch -BuildRequires: python-devel +BuildRequires: python2-devel Requires: ca-certificates @@ -42,21 +44,42 @@ Requires: python-chardet %prep %setup -q -n requests-%{version} +%patch0 -p1 + +### TODO: Need to unbundle libraries in the packages directory. +### https://bugzilla.redhat.com/show_bug.cgi?id=904623 +### Priority urllib3 since it's still bundled in requests-1.0.x +### And it's a security issue: +### https://bugzilla.redhat.com/show_bug.cgi?id=855322 +### https://bugzilla.redhat.com/show_bug.cgi?id=855323 +### Review request for urllib3: +### https://bugzilla.redhat.com/show_bug.cgi?id=907688 + +%if 0%{?_with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif # with_python3 + + %build -%{__python} setup.py build %if 0%{?_with_python3} +pushd %{py3dir} %{__python3} setup.py build +popd %endif +%{__python} setup.py build %install rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT %if 0%{?_with_python3} -%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT +popd %endif - +%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT + %files %defattr(-,root,root,-) %doc NOTICE LICENSE README.rst HISTORY.rst @@ -72,6 +95,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Fri Feb 8 2013 Toshio Kuratomi - 0.13.1-2 +- Fix a problem with cookie handling + + https://bugzilla.redhat.com/show_bug.cgi?id=906924 + * Sun Jun 10 2012 Arun S A G 0.13.1-1 - Updated to latest upstream release 0.13.1 - Use system provided ca-certificates