You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by karrageorgiou giannis <ka...@yahoo.com.INVALID> on 2021/02/28 21:43:51 UTC

[users@httpd] redirecting websockets to a unix domain socket

dear httpd users,

I (try to) do reverse proxying for a websocket connection
i.e.

** declaring:
    ProxyPass  /ws "unix:/tmp/usock|ws://localhost/ws")

** and having a process bind()-ing and listen()-ing on  
    that unix domain socket's path (tmp/usock)

if the listen()-ing process, accept()s a non-blocking
descriptor (i.e. do a accept4(...SOCK_NONBLOCK)), you
can talk to the client, but it consumes the CPU
(spinning around a read() returning -1 with errno=EAGAIN
99.9999% of the time)

if you accept() a blocking descriptor (i.e. plain
accept()), not a single byte comes out of it;
it blocks in the first read(), even trying to
read a one-byte buffer

all sane solutions I can think of, don't work:
select() on the fd never returns; even
flgs=fcntl(fd, F_GETFL) seems to misbehave as it
always returns flgs==0 (!!) (let alone F_SETFL)

has anyone tried rproxying in this way and succeeded?
am I doing something wrong, or httpd's code cannot
handle AF_UNIX in websocket's  persistent context?

thanks for any ideas or insights

(note: I don't need advice on how some node of
python webServer-package does it; I want to know
what really goes on with httpd)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org