Skip to content
Myr

cleanup utils.py

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 04ed1e5 · Browse files · 1 file+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:requests/utils.py+3 added-2 removed
492 unmodified lines
493494495# The unreserved URI characters (RFC 3986)496UNRESERVED_SET = frozenset(497 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"498 + "0123456789-._~")497 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789-._~")498499500def unquote_unreserved(uri):501 """Un-escape any percent-escape sequences in a URI that are unreserved
347 unmodified lines
849# Moved outside of function to avoid recompile every call850_CLEAN_HEADER_REGEX_BYTE = re.compile(b'^\\S[^\\r\\n]*$|^$')851_CLEAN_HEADER_REGEX_STR = re.compile(r'^\S[^\r\n]*$|^$')852853854def check_header_validity(header):855 """Verifies that header value is a string which doesn't contain856 leading whitespace or return characters. This prevents unintended857 header injection.
29 unmodified lines
887 netloc = netloc.rsplit('@', 1)[-1]888889 return urlunparse((scheme, netloc, path, params, query, ''))890891892def rewind_body(prepared_request):893 """Move file pointer back to its recorded starting position894 so it can be read again on redirect.895 """
9 unmodified lines