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

Merge remote branch 'origin/master' into signature

parents ef9bec3c 7d72c8b0
...@@ -20,6 +20,7 @@ import json ...@@ -20,6 +20,7 @@ import json
import os import os
import tempfile import tempfile
import urllib import urllib
import urllib2
import urlparse import urlparse
import M2Crypto import M2Crypto
...@@ -49,7 +50,7 @@ class NetworkcacheClient(object): ...@@ -49,7 +50,7 @@ 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 return_dict['port'] = parsed_url.port or 80
return return_dict return return_dict
def __init__(self, shacache, shadir, def __init__(self, shacache, shadir,
...@@ -161,17 +162,13 @@ class NetworkcacheClient(object): ...@@ -161,17 +162,13 @@ class NetworkcacheClient(object):
if directory_key is not None: if directory_key is not None:
path_info = os.path.join(self.shadir_path, directory_key) path_info = os.path.join(self.shadir_path, directory_key)
shadir_connection = httplib.HTTPConnection(self.shadir_host, url = "http://%s:%s%s" % (self.shadir_host, self.shadir_port, path_info)
self.shadir_port) request = urllib2.Request(url=url, data=None,headers=self.shadir_header_dict)
try: try:
shadir_connection.request('GET', path_info, headers=self.shadir_header_dict) result = urllib2.urlopen(request)
result = shadir_connection.getresponse()
data = result.read() data = result.read()
finally: except urllib2.HTTPError, error:
shadir_connection.close() raise DirectoryNotFound("%s : %s" % (error.code, error.msg))
if result.status != 200:
raise DirectoryNotFound(result.read())
# Filtering... # Filtering...
data_list = json.loads(data) data_list = json.loads(data)
......
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