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