|
@@ -34,7 +34,7 @@ class HydeRequestHandler(SimpleHTTPRequestHandler): |
|
|
and serve. |
|
|
and serve. |
|
|
""" |
|
|
""" |
|
|
self.server.request_time = datetime.now() |
|
|
self.server.request_time = datetime.now() |
|
|
logger.info("Processing request:[%s]" % self.path) |
|
|
|
|
|
|
|
|
logger.info("Processing request: [%s]" % self.path) |
|
|
result = urlparse.urlparse(self.path) |
|
|
result = urlparse.urlparse(self.path) |
|
|
query = urlparse.parse_qs(result.query) |
|
|
query = urlparse.parse_qs(result.query) |
|
|
if 'refresh' in query or result.query=='refresh': |
|
|
if 'refresh' in query or result.query=='refresh': |
|
@@ -45,7 +45,7 @@ class HydeRequestHandler(SimpleHTTPRequestHandler): |
|
|
parts[4] = urllib.urlencode(query) |
|
|
parts[4] = urllib.urlencode(query) |
|
|
parts = tuple(parts) |
|
|
parts = tuple(parts) |
|
|
new_url = urlparse.urlunparse(parts) |
|
|
new_url = urlparse.urlunparse(parts) |
|
|
logger.info('Redirecting...[%s]' % new_url) |
|
|
|
|
|
|
|
|
logger.info('Redirecting... [%s]' % new_url) |
|
|
self.redirect(new_url) |
|
|
self.redirect(new_url) |
|
|
else: |
|
|
else: |
|
|
SimpleHTTPRequestHandler.do_GET(self) |
|
|
SimpleHTTPRequestHandler.do_GET(self) |
|
@@ -59,7 +59,7 @@ class HydeRequestHandler(SimpleHTTPRequestHandler): |
|
|
path = SimpleHTTPRequestHandler.translate_path(self, path) |
|
|
path = SimpleHTTPRequestHandler.translate_path(self, path) |
|
|
site = self.server.site |
|
|
site = self.server.site |
|
|
result = urlparse.urlparse(self.path) |
|
|
result = urlparse.urlparse(self.path) |
|
|
logger.debug("Trying to load file based on request:[%s]" % result.path) |
|
|
|
|
|
|
|
|
logger.debug("Trying to load file based on request: [%s]" % result.path) |
|
|
path = result.path.lstrip('/') |
|
|
path = result.path.lstrip('/') |
|
|
res = None |
|
|
res = None |
|
|
if path.strip() == "" or File(path).kind.strip() == "": |
|
|
if path.strip() == "" or File(path).kind.strip() == "": |
|
@@ -72,7 +72,7 @@ class HydeRequestHandler(SimpleHTTPRequestHandler): |
|
|
res = site.content.resource_from_relative_deploy_path(path) |
|
|
res = site.content.resource_from_relative_deploy_path(path) |
|
|
|
|
|
|
|
|
if not res: |
|
|
if not res: |
|
|
logger.error("Cannot load file:[%s]" % path) |
|
|
|
|
|
|
|
|
logger.error("Cannot load file: [%s]" % path) |
|
|
|
|
|
|
|
|
return site.config.deploy_root_path.child(path) |
|
|
return site.config.deploy_root_path.child(path) |
|
|
else: |
|
|
else: |
|
@@ -95,7 +95,7 @@ class HydeRequestHandler(SimpleHTTPRequestHandler): |
|
|
message = "Requested resource not found" |
|
|
message = "Requested resource not found" |
|
|
if not res: |
|
|
if not res: |
|
|
logger.error( |
|
|
logger.error( |
|
|
"Cannot find the 404 template[%s]." |
|
|
|
|
|
|
|
|
"Cannot find the 404 template [%s]." |
|
|
% site.config.not_found) |
|
|
% site.config.not_found) |
|
|
else: |
|
|
else: |
|
|
f404 = File(self.translate_path(site.config.not_found)) |
|
|
f404 = File(self.translate_path(site.config.not_found)) |
|
|