Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
common: fix set_proxy, 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
iawia002 committed Feb 15, 2018
1 parent e836f67 commit 1336b2f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lulu/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,11 +988,11 @@ def parse_host(host):
"""Parses host name and port number from a string.
"""
if re.match(r'^(\d+)$', host) is not None:
return ("0.0.0.0", int(host))
return ('0.0.0.0', int(host))
if re.match(r'^(\w+)://', host) is None:
host = "//" + host
host = '//' + host
o = parse.urlparse(host)
hostname = o.hostname or "0.0.0.0"
hostname = o.hostname or '0.0.0.0'
port = o.port or 0
return (hostname, port)

Expand Down Expand Up @@ -1261,7 +1261,8 @@ def print_version():
if args.no_proxy:
unset_proxy()
else:
set_proxy(parse_host(args.http_proxy))
if args.http_proxy:
set_proxy(parse_host(args.http_proxy))
if args.socks_proxy:
set_socks_proxy(args.socks_proxy)

Expand Down

0 comments on commit 1336b2f

Please sign in to comment.