mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Smartsync: Don't fail if there isn't a cookiefile
Change-Id: I434a259f43ca9808e88051ac8ba865c519a24702
This commit is contained in:
parent
ba7bc738c1
commit
3010e5ba64
@ -905,19 +905,22 @@ class PersistentTransport(xmlrpc.client.Transport):
|
|||||||
# Python doesn't understand cookies with the #HttpOnly_ prefix
|
# Python doesn't understand cookies with the #HttpOnly_ prefix
|
||||||
# Since we're only using them for HTTP, copy the file temporarily,
|
# Since we're only using them for HTTP, copy the file temporarily,
|
||||||
# stripping those prefixes away.
|
# stripping those prefixes away.
|
||||||
tmpcookiefile = tempfile.NamedTemporaryFile()
|
if cookiefile:
|
||||||
try:
|
tmpcookiefile = tempfile.NamedTemporaryFile()
|
||||||
with open(cookiefile) as f:
|
try:
|
||||||
for line in f:
|
with open(cookiefile) as f:
|
||||||
if line.startswith("#HttpOnly_"):
|
for line in f:
|
||||||
line = line[len("#HttpOnly_"):]
|
if line.startswith("#HttpOnly_"):
|
||||||
tmpcookiefile.write(line)
|
line = line[len("#HttpOnly_"):]
|
||||||
tmpcookiefile.flush()
|
tmpcookiefile.write(line)
|
||||||
|
tmpcookiefile.flush()
|
||||||
|
|
||||||
cookiejar = cookielib.MozillaCookieJar(tmpcookiefile.name)
|
cookiejar = cookielib.MozillaCookieJar(tmpcookiefile.name)
|
||||||
cookiejar.load()
|
cookiejar.load()
|
||||||
finally:
|
finally:
|
||||||
tmpcookiefile.close()
|
tmpcookiefile.close()
|
||||||
|
else:
|
||||||
|
cookiejar = cookielib.CookieJar()
|
||||||
|
|
||||||
proxyhandler = urllib.request.ProxyHandler
|
proxyhandler = urllib.request.ProxyHandler
|
||||||
if proxy:
|
if proxy:
|
||||||
|
Loading…
Reference in New Issue
Block a user