Skip to content

Commit af21fa8

Browse files
author
leah.culver
committed
Python: fix for making sure the default ports are at the end of the string before stripping them. Thanks Brad Choate.
git-svn-id: https://oauth.googlecode.com/svn/code/python@1044 f7ae4463-c52f-0410-a7dc-93bad6e629e8
1 parent 1ba3d8b commit af21fa8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

oauth/oauth.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ def get_normalized_http_url(http://github.com/self):
202202
parts = urlparse.urlparse(self.http_url)
203203
scheme, netloc, path = parts[:3]
204204
# Exclude default port numbers.
205-
if scheme == 'http':
206-
netloc = netloc.rstrip(':80')
207-
elif scheme == 'https':
208-
netloc = netloc.rstrip(':443')
205+
if scheme == 'http' and netloc[-3:] == ':80':
206+
netloc = netloc[:-3]
207+
elif scheme == 'https' and netloc[-4:] == ':443':
208+
netloc = netloc[:-4]
209209
return '%s://%s%s' % (scheme, netloc, path)
210210

211211
def sign_request(self, signature_method, consumer, token):

0 commit comments

Comments
 (0)