diff --git a/requests/utils.py b/requests/utils.py index 056f6fb3..25af9923 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -494,8 +494,7 @@ def get_unicode_from_response(r): # The unreserved URI characters (RFC 3986) UNRESERVED_SET = frozenset( - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - + "0123456789-._~") + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789-._~") def unquote_unreserved(uri): @@ -851,6 +850,7 @@ def get_auth_from_url(url): _CLEAN_HEADER_REGEX_BYTE = re.compile(b'^\\S[^\\r\\n]*$|^$') _CLEAN_HEADER_REGEX_STR = re.compile(r'^\S[^\r\n]*$|^$') + def check_header_validity(header): """Verifies that header value is a string which doesn't contain leading whitespace or return characters. This prevents unintended @@ -888,6 +888,7 @@ def urldefragauth(url): return urlunparse((scheme, netloc, path, params, query, '')) + def rewind_body(prepared_request): """Move file pointer back to its recorded starting position so it can be read again on redirect.