[ 
https://issues.apache.org/jira/browse/PROTON-995?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alan Conway resolved PROTON-995.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 0.12.0

> Url fails to parse URL
> ----------------------
>
>                 Key: PROTON-995
>                 URL: https://issues.apache.org/jira/browse/PROTON-995
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: python-binding
>    Affects Versions: 0.10
>         Environment: Linux, Python 3.4.3
>            Reporter: Javier Ruere
>            Assignee: Alan Conway
>             Fix For: 0.12.0
>
>
> proton.Url apparently parses an URL correctly but then it fails as if it was 
> parsed incorrectly.
> It appears to fail to handle the escaped characters in the password and using 
> a default port.
> {quote}
> >>> import proton
> >>> from proton.reactor import Container
> >>> url = 
> >>> 'amqps://a_name:1w6MN0yeUqLUwDdWHk%2FxIR2Z6aIrhslm69lYtHA0r5E%3D@a_namespace.servicebus.windows.net/a_topic/Subscriptions/a_subscription'
> >>> purl=proton.Url(url)
> >>> purl
> Url('amqps://a_name:1w6MN0yeUqLUwDdWHk/xIR2Z6aIrhslm69lYtHA0r5E=@a_namespace.servicebus.windows.net:amqps/a_topic/Subscriptions/a_subscription')
> >>> container = Container()
> >>> receiver = container.create_receiver(purl)
> Traceback (most recent call last):
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/__init__.py",
>  line 3940, in _port_int
>     return int(value)
> ValueError: invalid literal for int() with base 10: '1w6MN0yeUqLUwDdWHk'
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/__init__.py",
>  line 3943, in _port_int
>     return socket.getservbyname(value)
> OSError: service/proto not found
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/reactor.py",
>  line 738, in create_receiver
>     session = self._get_session(context)
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/reactor.py",
>  line 660, in _get_session
>     return self._get_session(self.connect(url=context))
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/reactor.py",
>  line 637, in connect
>     if url: connector.address = Urls([url])
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/reactor.py",
>  line 577, in __init__
>     self.values = [Url(v) for v in values]
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/reactor.py",
>  line 577, in <listcomp>
>     self.values = [Url(v) for v in values]
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/__init__.py",
>  line 3967, in __init__
>     if defaults: self.defaults()
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/__init__.py",
>  line 4010, in defaults
>     self.port = self.port or self.Port(self.scheme)
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/__init__.py",
>  line 3984, in _get_port
>     return portstr and Url.Port(portstr)
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/__init__.py",
>  line 3928, in __new__
>     port = super(Url.Port, cls).__new__(cls, cls._port_int(value))
>   File 
> "/home/javier/tmp/virtualenvs/ss-update/lib/python3.4/site-packages/proton/__init__.py",
>  line 3949, in _port_int
>     raise ValueError("Not a valid port number or service name: '%s'" % value)
> ValueError: Not a valid port number or service name: '1w6MN0yeUqLUwDdWHk'
> >>> 
> >>> purl.port
> 5671
> >>> purl.password
> '1w6MN0yeUqLUwDdWHk/xIR2Z6aIrhslm69lYtHA0r5E='
> >>> purl.host
> 'a_namespace.servicebus.windows.net'
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to