add Accept header when downloading file#2437
Conversation
when trying to download file with urllib2 adding to the header the field Accept since the absence of such field can lead to some security module to raise a 403 response
|
|
||
| # use custom HTTP header | ||
| url_req = urllib2.Request(url, headers={'User-Agent': 'EasyBuild'}) | ||
| url_req = urllib2.Request(url, headers={'User-Agent': 'EasyBuild', "Accept" : "text/html"}) |
There was a problem hiding this comment.
@oliviermattelaer What does the text/html part mean here exactly?
There was a problem hiding this comment.
Actually, The only part check by the apache module seems to be that "Accept" is in the header and not empty.
But indeed it might make more sense to use here "/" which does not imply any restriction on the type of content that we accept.
Cheers,
Olivier
There was a problem hiding this comment.
I think we should use */* rather than text/html, to accept all types... Cfr. https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
Please make that change, then it should be OK to merge this.
There was a problem hiding this comment.
Sure. Done.
Thanks,
Olivier
|
@oliviermattelaer For future pull requests, please target the Going in, thanks for your contribution! |
when trying to download file with urllib2 adding to the header the field Accept since the absence of such field can lead to some security module to raise a 403 response:
https://serverfault.com/questions/377656/why-does-mod-security-require-an-accept-http-header-field