[Twisted-web] Changing the order of the request header lines that get sent.
richard77 at airmail.cc
richard77 at airmail.cc
Sat Jun 30 04:02:43 MDT 2018
Hello subscribers
I am using scrapy 1.4.0 which makes use of twisted 17.9.0 to send and
receive HTTP requests and responses
(https://github.com/scrapy/scrapy/blob/master/scrapy/core/downloader/handlers/http11.py
ScrapyAgent.download_request()). I would like to influence the order in
which the request header lines get sent.
With scrapy the request header is always handled as a python dictionary
and therefore can not be sorted. So I was looking at the twisted source
code to find the place where it sends the request header and
discontinues to use a dictionary (where I would be able to modify the
order at this place).
Unfortunately I couldn't find it till now. Agent.request() gets the
request headers as a dictionary and then returns
self._requestWithEndpoint() with the headers dictionary in
https://github.com/twisted/twisted/blob/trunk/src/twisted/web/client.py
on line 1655.
_AgentBase._requestWithEndpoint() on line 1419 then seems to send the
request but where can I change the order of the headers? Hopefully you
can help me with the problem.
More information about the Twisted-web
mailing list