diff options
| author | Kali Kaneko <kali@leap.se> | 2013-07-02 22:29:32 +0900 | 
|---|---|---|
| committer | Kali Kaneko <kali@leap.se> | 2013-07-02 22:29:32 +0900 | 
| commit | 1d30e2580592ef905d9b21c475459da1e40b1cd6 (patch) | |
| tree | 6ec48c6b5234da55ecc91ad3c6235fb20b61315c /src/leap/util/web.py | |
| parent | 81dc8ebe9ef46c0fafa75cba5c4959bb822da686 (diff) | |
| parent | 5b975799ce9b7a6e0a88be4bcb48bdfb90800bb3 (diff) | |
Merge branch 'master' of ssh://leap.se/leap_client
Diffstat (limited to 'src/leap/util/web.py')
| -rw-r--r-- | src/leap/util/web.py | 40 | 
1 files changed, 0 insertions, 40 deletions
diff --git a/src/leap/util/web.py b/src/leap/util/web.py deleted file mode 100644 index 15de0561..00000000 --- a/src/leap/util/web.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -web related utilities -""" - - -class UsageError(Exception): -    """ """ - - -def get_https_domain_and_port(full_domain): -    """ -    returns a tuple with domain and port -    from a full_domain string that can -    contain a colon -    """ -    full_domain = unicode(full_domain) -    if full_domain is None: -        return None, None - -    https_sch = "https://" -    http_sch = "http://" - -    if full_domain.startswith(https_sch): -        full_domain = full_domain.lstrip(https_sch) -    elif full_domain.startswith(http_sch): -        raise UsageError( -            "cannot be called with a domain " -            "that begins with 'http://'") - -    domain_split = full_domain.split(':') -    _len = len(domain_split) -    if _len == 1: -        domain, port = full_domain, 443 -    elif _len == 2: -        domain, port = domain_split -    else: -        raise UsageError( -            "must be called with one only parameter" -            "in the form domain[:port]") -    return domain, port  | 
