chrysn / aiocoap

The Python CoAP library
Other
262 stars 119 forks source link

Erroneous code in exception path #314

Open chrysn opened 11 months ago

chrysn commented 11 months ago

AttributeError when raising AnonymousHost:

$ ./aiocoap-rd --proxy-domain proxy.example.net &
$ ./aiocoap-widgets --register coap+ws://localhost:8683 --anyport
[...]
  File "/home/chrysn/git/aiocoap/aiocoap/transports/rfc8323common.py", line 65, in uri_base
    raise error.AnonymousHost("Client side of %s can not be expressed as a URI" % self._ctx._scheme)
                                                                                  ^^^^^^^^^
AttributeError: 'WSRemote' object has no attribute '_ctx'

(It's not surprising that an error is raised, but it should be silent on the server and take the proper error path).

The proper way to fix this on the application side is to add --registery-proxy to the widget invocation, but the 5.00 doesn't tell that.