support for HEAD requests

This commit is contained in:
mdipierro
2012-08-29 08:22:35 -05:00
parent edeb237777
commit 9861a33c72
3 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.00.1 (2012-08-29 07:27:23) rc4
Version 2.00.1 (2012-08-29 08:22:30) rc4
+4 -2
View File
@@ -76,7 +76,7 @@ class HTTP(BaseException):
self.headers['Set-Cookie'] = [
str(cookie)[11:] for cookie in cookies.values()]
def to(self, responder):
def to(self, responder, env={}):
status = self.status
headers = self.headers
if status in defined_status:
@@ -100,7 +100,9 @@ class HTTP(BaseException):
else:
rheaders.append((k, str(v)))
responder(status, rheaders)
if isinstance(body,str):
if env.get('request_method','')=='HEAD':
return ['']
elif isinstance(body,str):
return [body]
elif hasattr(body, '__iter__'):
return body
+3 -2
View File
@@ -526,7 +526,8 @@ def wsgibase(environ, responder):
except HTTP, http_response:
if static_file:
return http_response.to(responder)
return http_response.to(responder,env=env)
if request.body:
request.body.close()
@@ -636,7 +637,7 @@ def wsgibase(environ, responder):
return wsgibase(new_environ,responder)
if global_settings.web2py_crontype == 'soft':
newcron.softcron(global_settings.applications_parent).start()
return http_response.to(responder)
return http_response.to(responder,env=env)
def save_password(password, port):