Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct "Host" header test #154

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
9 changes: 5 additions & 4 deletions src/funkload/PatchWebunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,11 @@ def WF_fetch(self, url, postdata=None, server=None, port=None, protocol=None,
# Other Full Request headers
if self.authinfo:
headers.append(('Authorization', "Basic %s"%self.authinfo))

#If a value is specified for 'Host' then another value should not be appended
if not webproxy and not 'Host' in self.extra_headers.keys():

# If a value is specified for 'Host' then another value should not be appended.
# self.extra_headers is a list of tuples, convert to dictionary to make the
# test work.
if not webproxy and not 'Host' in dict(self.extra_headers):
# HTTPConnection seems to add a host header itself.
# So we only need to do this if we are not using a proxy.
headers.append(('Host', host_header))
Expand Down Expand Up @@ -539,4 +541,3 @@ def HR___repr__(self):
self.message)

HTTPResponse.__repr__ = HR___repr__