Commit 4500e063 authored by Alexandre's avatar Alexandre
Browse files

[DoH] Verify that a HEAD response has an empty body

parent c6cfbd96
......@@ -401,8 +401,8 @@ class ConnectionDoH(Connection):
response = "Content type of the response (\"%s\") invalid" % ctype
ok = False
else:
body = buffer.getvalue()
if not head:
body = buffer.getvalue()
try:
size = len(body)
response = dns.message.from_wire(body)
......@@ -415,7 +415,11 @@ class ConnectionDoH(Connection):
response = "ERROR Not proper DNS data (wrong path in the URL?) \"%s\"" % body[:100]
ok = False
else:
response = "HEAD successful"
if len(body) == 0:
response = "HEAD successful"
else:
response = "ERROR Body length is not null \"%s\"" % body[:100]
ok = False
else:
ok = False
body = buffer.getvalue()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment