Skip to content

Commit

Permalink
http/https
Browse files Browse the repository at this point in the history
  • Loading branch information
andgineer committed Apr 23, 2019
1 parent 4b1de5b commit a854041
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bombard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '1.15.1'
__version__ = '1.16.1'


def version():
Expand Down
16 changes: 11 additions & 5 deletions bombard/http_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ def http_request(url: str, method: str='GET', headers: Optional[dict]=None,
try:
url = urlparse(url)
kwargs = {'timeout': timeout} if timeout is not None else {}
conn = http.client.HTTPSConnection(
url.netloc,
context=ssl._create_unverified_context(),
**kwargs,
)
if url.scheme.lower() == 'https':
conn = http.client.HTTPSConnection(
url.netloc,
context=ssl._create_unverified_context(),
**kwargs,
)
else:
conn = http.client.HTTPConnection(
url.netloc,
**kwargs,
)
conn.request(
method,
url.path,
Expand Down

0 comments on commit a854041

Please sign in to comment.