I am writing an apache module. I need to recieve arbitrary data from the client after authentication. In principle my solution requires me to write a loop that allows the program to read and write from a socket — or the apache underlying mechanism for socket IO.
I know this might be the XY problem, but I can't think of another way to do this. My program is ready to start bidirectional communication but I have searched the web and I have failed to find something useful.
I also inspected the request_rec
structure and all the relevant structures of some of it's fields and I didn't find anything that looks interesting or relevant for this problem.
What you want is actually very similar to Apache's WebSocket proxy module, so it should be possible.
In particular, a request handler can access the underlying socket with ap_get_conn_socket(r->connection)
. Getting the module to behave in a way that won't put the request in a nonsensical state will be trickier. However, the source of mod_wstunnel is here; that should help guide you. Good luck!