From 49294a6a7cb6e9ece1c1814d629e2d9e497180fa Mon Sep 17 00:00:00 2001 From: Dariusz Smigiel Date: Thu, 19 May 2022 09:41:59 -0700 Subject: OAuth1: Allow IPv6 addresses being parsed by signature This PR addresses issue with incorrectly parsing IPv6 address, described here: https://github.com/oauthlib/oauthlib/issues/817 --- oauthlib/oauth1/rfc5849/signature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oauthlib/oauth1/rfc5849/signature.py b/oauthlib/oauth1/rfc5849/signature.py index a370ccd..424393b 100644 --- a/oauthlib/oauth1/rfc5849/signature.py +++ b/oauthlib/oauth1/rfc5849/signature.py @@ -173,7 +173,7 @@ def base_string_uri(uri: str, host: str = None) -> str: if ':' in netloc: # Contains a colon ":", so try to parse as "host:port" - hostname, port_str = netloc.split(':', 1) + hostname, port_str = netloc.rsplit(':', 1) if len(hostname) == 0: raise ValueError('missing host') # error: netloc was ":port" or ":" -- cgit v1.2.1