mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-13 07:56:14 +01:00
Merge pull request #1249 from dmach/fix-cookiejar-load-error
connection: Save cookiejar only when there's a Set-Cookie header in the response
This commit is contained in:
commit
34ad8f3dd8
@ -451,7 +451,10 @@ class CookieJarAuthHandler(AuthHandlerBase):
|
|||||||
pass
|
pass
|
||||||
jar = http.cookiejar.LWPCookieJar(self.cookiejar_path)
|
jar = http.cookiejar.LWPCookieJar(self.cookiejar_path)
|
||||||
if os.path.isfile(self.cookiejar_path):
|
if os.path.isfile(self.cookiejar_path):
|
||||||
|
try:
|
||||||
jar.load()
|
jar.load()
|
||||||
|
except http.cookiejar.LoadError:
|
||||||
|
pass
|
||||||
self.COOKIEJARS[self.cookiejar_path] = jar
|
self.COOKIEJARS[self.cookiejar_path] = jar
|
||||||
return jar
|
return jar
|
||||||
|
|
||||||
@ -484,6 +487,7 @@ class CookieJarAuthHandler(AuthHandlerBase):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def process_response(self, url, request_headers, response):
|
def process_response(self, url, request_headers, response):
|
||||||
|
if response.headers.get_all("set-cookie", None):
|
||||||
self._cookiejar.extract_cookies(response, MockRequest(url, response.headers))
|
self._cookiejar.extract_cookies(response, MockRequest(url, response.headers))
|
||||||
self._cookiejar.save()
|
self._cookiejar.save()
|
||||||
self._unlock()
|
self._unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user