Commit d29bbd0c authored by Alexandre's avatar Alexandre
Browse files

[DoH] Store HTTP method in Request object (POST,HEAD)

parent cff5ba60
......@@ -187,6 +187,7 @@ class RequestDoH:
self.message.id = 0 # DoH requests that
self.message.flags |= dns.flags.AD # Ask for validation
self.data = self.message.to_wire()
self.post = False
self.head = False
def check_response(self):
......@@ -424,9 +425,9 @@ class ConnectionDoH(Connection):
self.reset_opt_default()
except AttributeError:
self.create_handle()
if self.post:
if self.post or request.post:
self.prepare_post(request)
elif self.head:
elif self.head or request.head:
self.prepare_head(request)
request.head = True
else:
......@@ -438,11 +439,13 @@ class ConnectionDoH(Connection):
self.set_opt(pycurl.URL, self.server + ("?dns=%s" % dns_req))
def prepare_post(self, request):
request.post = True
self.set_opt(pycurl.POST, True)
self.set_opt(pycurl.POSTFIELDS, request.data)
self.set_opt(pycurl.URL, self.server)
def prepare_head(self, request):
request.head = True
self.prepare_get(request)
self.set_opt(pycurl.NOBODY, True)
......
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