[Twisted-web] headers and HTTPDownloader

Lenny G Arbage alengarbage at yahoo.com
Fri May 12 12:15:45 CDT 2006


HTTPDownloader's gotHeaders() method never sets
response_headers, and, in fact, doesn't do anything
with the headers dict that it is handed, other than
extract 'content-range' for its own use.  The headers
get thrown away.

By adding a "self.response_headers = headers" line to
gotHeaders() (as HTTPClientFactory does),
HTTPDownloader can keep a copy of the headers that are
then stored in the factory object.

For now I'm just subclassing HTTPDownloader and
overriding gotHeaders so that I get the desired
behavior:

class
HTTPDownloaderWithHeaders(client.HTTPDownloader):
    def gotHeaders(self, headers):
        self.response_headers = headers
        client.HTTPDownloader.gotHeaders(self,
            headers)


Lenny

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Twisted-web mailing list