Changing the order of the request header lines that get sent.
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... 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.
participants (1)
-
richard77@airmail.cc