1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-25 19:30:54 +00:00

Drop body for HEAD requests last

This commit is contained in:
Unrud 2022-01-19 19:58:05 +01:00
parent 3420c182a9
commit a4e0e21e86
2 changed files with 4 additions and 3 deletions

View file

@ -117,6 +117,8 @@ class Application(ApplicationPartDelete, ApplicationPartHead,
headers = [*raw_headers, ("Content-Length", str(len(answer)))]
answers = [answer]
start_response(status_text, headers)
if environ.get("REQUEST_METHOD") == "HEAD":
return []
return answers
def _handle_request(self, environ: types.WSGIEnviron
@ -148,8 +150,7 @@ class Application(ApplicationPartDelete, ApplicationPartHead,
headers["Content-Encoding"] = "gzip"
headers["Content-Length"] = str(len(answer))
if request_method != "HEAD":
answers.append(answer)
answers.append(answer)
# Add extra headers set in configuration
headers.update(self._extra_headers)