From 18f4d88231ae985f855d0114c3a2bee674ee22ae Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Thu, 2 Feb 2023 10:54:59 +0100 Subject: [PATCH] connection: Save cookiejar only when there's a Set-Cookie header in the response --- osc/connection.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osc/connection.py b/osc/connection.py index 65421e74..0b2ecfdc 100644 --- a/osc/connection.py +++ b/osc/connection.py @@ -484,8 +484,9 @@ class CookieJarAuthHandler(AuthHandlerBase): return False def process_response(self, url, request_headers, response): - self._cookiejar.extract_cookies(response, MockRequest(url, response.headers)) - self._cookiejar.save() + if response.headers.get_all("set-cookie", None): + self._cookiejar.extract_cookies(response, MockRequest(url, response.headers)) + self._cookiejar.save() self._unlock()