summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2018-07-06 23:09:24 +0200
committerJulien Cristau <jcristau@debian.org>2018-07-06 23:09:24 +0200
commitef94a323147ff01f512a8be2a8840d7a1d43a07a (patch)
tree8b75ddac6be3a901f4a9277da2a68768ee3afec5 /lib
parent80d00dd36ba84e16e6fc578eb598d726a7f269ed (diff)
lib: add support for the HEAD HTTP method
Fixes security-tracker-team/security-tracker#3
Diffstat (limited to 'lib')
-rw-r--r--lib/python/web_support.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/python/web_support.py b/lib/python/web_support.py
index da68b7d315..d67d445bdf 100644
--- a/lib/python/web_support.py
+++ b/lib/python/web_support.py
@@ -663,7 +663,8 @@ class HTMLResult(Result):
buf = buf.getvalue()
def later(req):
headers_later(req)
- req.wfile.write(buf)
+ if req.command != 'HEAD':
+ req.wfile.write(buf)
return later
class BinaryResult(Result):
@@ -685,7 +686,8 @@ class BinaryResult(Result):
headers_later = super(BinaryResult, self).flatten_later()
def later(req):
headers_later(req)
- req.wfile.write(self.contents)
+ if req.command != 'HEAD':
+ req.wfile.write(self.contents)
return later
class WebServiceBase:
@@ -803,6 +805,7 @@ class WebServiceHTTP(WebServiceBase):
finally:
service_self.lock.release()
result(self)
+ do_HEAD = do_GET
def __parse_path(self):
pos = self.path.find('?')

© 2014-2024 Faster IT GmbH | imprint | privacy policy