mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-26 04:02:11 +00:00
[utils] Simplify cookie processor
This commit is contained in:
parent
cf83f532ae
commit
266e466ee4
1 changed files with 1 additions and 3 deletions
|
@ -797,9 +797,7 @@ class YoutubeDLCookieProcessor(compat_urllib_request.HTTPCookieProcessor):
|
||||||
for set_cookie_header in ('Set-Cookie', 'Set-Cookie2'):
|
for set_cookie_header in ('Set-Cookie', 'Set-Cookie2'):
|
||||||
set_cookie = response.headers.get(set_cookie_header)
|
set_cookie = response.headers.get(set_cookie_header)
|
||||||
if set_cookie:
|
if set_cookie:
|
||||||
set_cookie_escaped = '; '.join([
|
set_cookie_escaped = compat_urllib_parse.quote(set_cookie, b"%/;:@&=+$,!~*'()?#[] ")
|
||||||
escape_rfc3986(cookie_attr.strip())
|
|
||||||
for cookie_attr in set_cookie.decode('iso-8859-1').split(';')]).encode('iso-8859-1')
|
|
||||||
if set_cookie != set_cookie_escaped:
|
if set_cookie != set_cookie_escaped:
|
||||||
del response.headers[set_cookie_header]
|
del response.headers[set_cookie_header]
|
||||||
response.headers[set_cookie_header] = set_cookie_escaped
|
response.headers[set_cookie_header] = set_cookie_escaped
|
||||||
|
|
Loading…
Reference in a new issue