[patch] add extra http headers to request

Gustavo Niemeyer gustavo at niemeyer.net
Thu Nov 22 09:36:36 PST 2007


Hi Mauricio,

> I'm coding a plugin (will send for review after polishing) and because
> of it I had the need to add a way to send extra http headers to the file
> download request.

Looking forward to checking it out.

> The patch attached can be used in the following way:
> 
> fetcher.setHttpHeaders({'header1': 'value1'], 'header2': 'value2'})

A few review comments:

[1]

This information is specific to certain fetchers, and we already have a
generic way to pass information to the fetcher when the url is enqueued.

I suggest something like:

    fetcher.enqueue(url, http_headers={...})

You can get that information in the specific fetcher with:

    item.getInfo("http_headers")

[2]

We have two different fetchers, one using PyCurl, and the other using
urllib2.  It'd be important to add support for both of them, otherwise your
plugin will break depending on installed dependencies.

[3]

Please provide full test coverage for the changes.


-- 
Gustavo Niemeyer
http://niemeyer.net



More information about the Smart mailing list