httprd icon indicating copy to clipboard operation
httprd copied to clipboard

connecting to httprd gets No WebSocket UPGRADE hdr: None

Open te-anhydros opened this issue 1 year ago • 7 comments

We installed httprd per the README.md. We start httprd and see the following response from the shell:

$ python /usr/local/src/httprd/httprd.py --port 12345 --password=FOO --view_password=BAR --fullscreen
======== Running on http://0.0.0.0:12345 ========
(Press CTRL+C to quit)

When I connect from a browser running on 1.2.3.5 with http://1.2.3.4:12345/connect_view_ws?password=FOO, the browser does not show the desktop display, but only returns:

No WebSocket UPGRADE hdr: None
 Can "Upgrade" only to "WebSocket".

And the console shows the message:

[06.01.2025-21:16:00] 1.2.3.5 GET [VIEW] /connect_view_ws?password=FOO

What did I miss? How do I resolve this?

te-anhydros avatar Jan 06 '25 21:01 te-anhydros

Something related to https://github.com/aio-libs/aiohttp/issues/7224

Will investigate later

bitrate16 avatar Jan 07 '25 01:01 bitrate16

@te-anhydros are you trying to connect directly to _ws endpoint in browser address bar? If yes, It does not work like that. You need to open http://1.2.3.4:12345 instead

bitrate16 avatar Jan 07 '25 01:01 bitrate16

@bitrate16

I tried http://1.2.3.4:12345/?password=FOO and saw the following in the console:

[07.01.2025-08:53:59] 192.168.0.117 GET /?FOO
[07.01.2025-08:54:00] 192.168.0.117 GET [NO ACCESS] /connect_view_ws?password=
[07.01.2025-08:54:01] 192.168.0.117 GET [NO ACCESS] /connect_input_ws?password=
[07.01.2025-08:54:06] 192.168.0.117 GET [NO ACCESS] /connect_view_ws?password=
[07.01.2025-08:54:07] 192.168.0.117 GET [NO ACCESS] /connect_input_ws?password=
[07.01.2025-08:54:12] 192.168.0.117 GET [NO ACCESS] /connect_view_ws?password=

and repeat.

I tried http://1.2.3.4:12345 and saw the following in the console:

[07.01.2025-08:56:08] 192.168.0.117 GET /
[07.01.2025-08:56:08] 192.168.0.117 GET [NO ACCESS] /connect_view_ws?password=
[07.01.2025-08:56:09] 192.168.0.117 GET [NO ACCESS] /connect_view_ws?password=
[07.01.2025-08:56:09] 192.168.0.117 GET [NO ACCESS] /connect_input_ws?password=
[07.01.2025-08:56:15] 192.168.0.117 GET [NO ACCESS] /connect_view_ws?password=
[07.01.2025-08:56:15] 192.168.0.117 GET [NO ACCESS] /connect_input_ws?password=
[07.01.2025-08:56:21] 192.168.0.117 GET [NO ACCESS] /connect_view_ws?password=
[07.01.2025-08:56:21] 192.168.0.117 GET [NO ACCESS] /connect_input_ws?password=

and repeat.

How do we convey the password from the browser via the URL?

te-anhydros avatar Jan 07 '25 09:01 te-anhydros

@bitrate16 you wrote:

Something related to aio-libs/aiohttp#7224

Will investigate later

I see in this comment to that issue:

What do you mean by open in browser? They are Websocket endpoints, so you'd need to write some JS to open a websocket, right?

Oh ... looks like I get the issue, it is just not possible to upgrade to WebSocket using browser ...

Please excuse my ignorance, which is vast.

Is a browser inappropriate for connecting to an httprd server? Is there a browser extension (chrome or firefox) that does have the necessary JS to open a websocket?

Thanks!

te-anhydros avatar Jan 07 '25 09:01 te-anhydros

Is a browser inappropriate for connecting to an httprd server? Is there a browser extension (chrome or firefox) that does have the necessary JS to open a websocket?

When you connect through address bar, it sends plain HTTP request and does not support UPGRADE to websocket. If you need to view the websocket stream, you need a websocket client. Also, since it's using custom protocol, you won't see the image through the direct connection, just raw data that needs to be decoded.

I would suggest to open http://1.2.3.4:12345 and set password to view

bitrate16 avatar Jan 08 '25 10:01 bitrate16

Hi @bitrate16,

You wrote:

I would suggest to open http://1.2.3.4:12345 and set password to view

Please also suggest which tool(s) that we can use to open http://1.2.3.4:12345 that will allow viewing and using the X display server. Ideally, this would be an extension to Firefox or Chrome, but if there's something else, please let us know.

Thanks!

te-anhydros avatar Jan 10 '25 13:01 te-anhydros

@te-anhydros There are no tools as far as I know because it is not common standard. Instead you may use vnc or rdp-based solutions for view through X11 sessions

bitrate16 avatar Jan 13 '25 18:01 bitrate16