Commit 1d62e8ac authored by Lucas Carvalho's avatar Lucas Carvalho

Don't use a hardcoded port value.

It must be able to return the default port for a given protocol.
(i.e. http - 80, https - 443)
parent 2cb1d7c6
...@@ -23,6 +23,7 @@ import urllib ...@@ -23,6 +23,7 @@ import urllib
import urllib2 import urllib2
import urlparse import urlparse
import M2Crypto import M2Crypto
import socket
class NetworkcacheClient(object): class NetworkcacheClient(object):
...@@ -47,7 +48,9 @@ class NetworkcacheClient(object): ...@@ -47,7 +48,9 @@ class NetworkcacheClient(object):
return_dict['path'] = parsed_url.path return_dict['path'] = parsed_url.path
return_dict['host'] = parsed_url.hostname return_dict['host'] = parsed_url.hostname
return_dict['port'] = parsed_url.port or 80 return_dict['port'] = parsed_url.port or \
socket.getservbyname(parsed_url.scheme)
return return_dict return return_dict
def __init__(self, shacache, shadir, def __init__(self, shacache, shadir,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment