mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #45814 from gtmanfred/2017.7
fix cookies dict size changing in http.query
This commit is contained in:
commit
643a8a5278
@ -532,7 +532,7 @@ def query(url,
|
||||
not isinstance(result_text, six.text_type):
|
||||
result_text = result_text.decode(res_params['charset'])
|
||||
ret['body'] = result_text
|
||||
if 'Set-Cookie' in result_headers.keys() and cookies is not None:
|
||||
if 'Set-Cookie' in result_headers and cookies is not None:
|
||||
result_cookies = parse_cookie_header(result_headers['Set-Cookie'])
|
||||
for item in result_cookies:
|
||||
sess_cookies.set_cookie(item)
|
||||
@ -857,12 +857,10 @@ def parse_cookie_header(header):
|
||||
for cookie in cookies:
|
||||
name = None
|
||||
value = None
|
||||
for item in cookie:
|
||||
for item in list(cookie):
|
||||
if item in attribs:
|
||||
continue
|
||||
name = item
|
||||
value = cookie[item]
|
||||
del cookie[name]
|
||||
value = cookie.pop(item)
|
||||
|
||||
# cookielib.Cookie() requires an epoch
|
||||
if 'expires' in cookie:
|
||||
@ -870,7 +868,7 @@ def parse_cookie_header(header):
|
||||
|
||||
# Fill in missing required fields
|
||||
for req in reqd:
|
||||
if req not in cookie.keys():
|
||||
if req not in cookie:
|
||||
cookie[req] = ''
|
||||
if cookie['version'] == '':
|
||||
cookie['version'] = 0
|
||||
|
Loading…
Reference in New Issue
Block a user