/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/urlutils.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-09-13 12:50:28 UTC
  • mfrom: (7096.2.2 empty-port)
  • Revision ID: breezy.the.bot@gmail.com-20180913125028-mja5gz8xsams9iey
Allow port to be empty when parsing URLs.

Merged from https://code.launchpad.net/~jelmer/brz/empty-port/+merge/354640

Show diffs side-by-side

added added

removed removed

Lines of Context:
929
929
        if ':' in host and not (host[0] == '[' and host[-1] == ']'):
930
930
            # there *is* port
931
931
            host, port = host.rsplit(':', 1)
932
 
            try:
933
 
                port = int(port)
934
 
            except ValueError:
935
 
                raise InvalidURL('invalid port number %s in url:\n%s' %
936
 
                                 (port, url))
 
932
            if port:
 
933
                try:
 
934
                    port = int(port)
 
935
                except ValueError:
 
936
                    raise InvalidURL('invalid port number %s in url:\n%s' %
 
937
                                     (port, url))
 
938
            else:
 
939
                port = None
937
940
        if host != "" and host[0] == '[' and host[-1] == ']': #IPv6
938
941
            host = host[1:-1]
939
942