views:

20

answers:

1

I'm using my own resolver and would like to use urllib2 to just connect to the IP (no resolving in urllib2) and I would like set the HTTP Host-header myself. But urllib2 is just ignoring my Host-header:

txheaders = { 'User-Agent': UA, "Host: ": nohttp_url }
robots = urllib2.Request("http://" + ip  + "/robots.txt", txdata, txheaders)
+2  A: 

You have included ": " in the "Host" string.

txheaders = { "User-Agent": UA, "Host": nohttp_url }
robots = urllib2.Request("http://" + ip  + "/robots.txt", txdata, txheaders)
katrielalex
Haha, thanks for noticing the typo. Should I/can I remove my question?
jonasl
@jonasl No, you should click the checkmark and move on ;)
aaronasterling