christgau / wsdd

A Web Service Discovery host daemon.
MIT License
807 stars 97 forks source link

http.client.InvalidURL: URL can't contain control characters. '192.168.129.6:3910 http' (found at least ' ') #199

Closed bigon closed 4 months ago

bigon commented 4 months ago

Hello,

I'm just experimenting with wsdd now that GNOME is using it, and I can see a stacktrace on my system:

2024-02-17 15:21:06,133:asyncio ERROR(pid 8484): Exception in callback MulticastHandler.read_socket(<socket.socke....0.0', 47444)>)
handle: <Handle MulticastHandler.read_socket(<socket.socke....0.0', 47444)>)>
Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/bin/wsdd", line 328, in read_socket
    handler.handle_packet(msg.decode('utf-8'), address)
  File "/usr/bin/wsdd", line 739, in handle_packet
    self.handle_message(msg, src)
  File "/usr/bin/wsdd", line 532, in handle_message
    retval = handler(header, body)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/wsdd", line 795, in handle_probe_match
    self.perform_metadata_exchange(endpoint, xaddr)
  File "/usr/bin/wsdd", line 846, in perform_metadata_exchange
    with urllib.request.urlopen(request, None, 2.0) as stream:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/urllib/request.py", line 519, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/urllib/request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/urllib/request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/usr/lib/python3.11/urllib/request.py", line 1377, in http_open
    return self.do_open(http.client.HTTPConnection, req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/urllib/request.py", line 1317, in do_open
    h = http_class(host, timeout=req.timeout, **http_conn_args)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/http/client.py", line 865, in __init__
    self._validate_host(self.host)
  File "/usr/lib/python3.11/http/client.py", line 1251, in _validate_host
    raise InvalidURL(f"URL can't contain control characters. {host!r} "
http.client.InvalidURL: URL can't contain control characters. '192.168.129.6:3910  http' (found at least ' ')

192.168.129.6 is a "HP LaserJet P2055dn" printer

bigon commented 4 months ago

debug log

bigon commented 4 months ago

https://learn.microsoft.com/en-us/windows/win32/wsdapi/xaddr-validation-rules

christgau commented 4 months ago

Looks like a duplicate of #149 which was fixed in c4a5f346bbb22777a8f66b0d6c6ef899f6d6cc74.

Also looks like a new release should be made so that Gnome can use it. I assume it's v0.7.1 that is used on your machine. You can check with wsdd --version. If it's a newer commit, feel free to re-open.

bigon commented 4 months ago

FTR I'm indeed running 0.7.1

$ wsdd --version
wsdd - Web Service Discovery Daemon, v0.7.1

I've retried with https://github.com/christgau/wsdd/commit/c4a5f346bbb22777a8f66b0d6c6ef899f6d6cc74 applied and it's indeed now working

bigon commented 4 months ago

@christgau Do you have an ETA for a new release?

christgau commented 4 months ago

Do you have an ETA for a new release?

Anytime soon... or later 😬 Depends on my not-so-side-project duties. I'd like to integrate the OpenBSD branch as well. Should be trivial but needs some time too. But. Be assured, the release is not forgotten.