]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[utils] Simplify cookie processor
authorSergey M․ <dstftw@gmail.com>
Sun, 6 Sep 2015 01:53:11 +0000 (07:53 +0600)
committerSergey M․ <dstftw@gmail.com>
Sun, 6 Sep 2015 01:53:11 +0000 (07:53 +0600)
youtube_dl/utils.py

index 5529d5291cda4df65279525eb581b475cb19dca9..9c547729eb2dbe332a611a2af76bc82d05d20c97 100644 (file)
@@ -797,9 +797,7 @@ class YoutubeDLCookieProcessor(compat_urllib_request.HTTPCookieProcessor):
             for set_cookie_header in ('Set-Cookie', 'Set-Cookie2'):
                 set_cookie = response.headers.get(set_cookie_header)
                 if set_cookie:
-                    set_cookie_escaped = '; '.join([
-                        escape_rfc3986(cookie_attr.strip())
-                        for cookie_attr in set_cookie.decode('iso-8859-1').split(';')]).encode('iso-8859-1')
+                    set_cookie_escaped = compat_urllib_parse.quote(set_cookie, b"%/;:@&=+$,!~*'()?#[] ")
                     if set_cookie != set_cookie_escaped:
                         del response.headers[set_cookie_header]
                         response.headers[set_cookie_header] = set_cookie_escaped