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
commit94dae912e6fdd2ca21f90c395b8dd6c07393d3c1 (patch)
tree5cf505bdbf308ec5a67efd53a35e28c03c795dea /lib
parent78b980b5da343d734d4a66c6b462139804701866 (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