Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions httpretrieve.r2py
Original file line number Diff line number Diff line change
Expand Up @@ -537,16 +537,18 @@ def _httpretrieve_build_request(host, port, path, querydata, postdata, \
else:
# there is no proxy; send normal http request
requeststr = methodstr + ' ' + path + resourcestr + ' HTTP/1.0\r\n'

if httpheaders is not None:
# Most servers require a 'Host' header for normal functionality
# (especially in the case of multiple domains being hosted on a
# single server).
if "Host" not in httpheaders:
requeststr += "Host: " + host + ':' + str(port) + "\r\n"

for key, val in httpheaders.items():
requeststr += key + ": " + val + '\r\n'

# Make sure there is an httpheaders dict
if httpheaders is None:
httpheaders = {}
# Most servers require a 'Host' header for normal functionality
# (especially in the case of multiple domains being hosted on a
# single server).
if "Host" not in httpheaders:
requeststr += "Host: " + host + ':' + str(port) + "\r\n"

for key, val in httpheaders.items():
requeststr += key + ": " + str(val) + '\r\n'

# Affix post-data related headers and content:
if methodstr == "POST":
Expand Down