Errors with desock.so and desock.dup
powerthe900 opened this issue · 8 comments
I am trying to use preeny to make recieve http requests from stdin. Hence, I used desock.so and desock_dup,so. When I use desock.so, I get this error: setsockopt(TCP_NODELAY) failed: Operation not supported. When I use desock_dup.so, I get this error: setting default fds failed: Success.
Have you guys occurred this error before? How would I solve this?
It looks like lighttpd is treating the socketpair that preeny replaced the network connection with as a network socket, and is trying to set socket options on it. The way to handle this for desock is to add some handling (probably just return 0
) for setsockopts in the module. Not sure what's happening with desock_dup, but I'm guessing a similar root cause (treating the FD as a socket).
Sorry if the source code part looks wierd.
The return zero method did not work.
The binary has a one shot mode that process single (one) request on stdin socket, then exit. When I use desock.so and pass a normal http request through stdin, it says that -1 is not a socket. How would I bypass this?
Ive got it to work
What was the solution in the end?
FYI: the next version of lighttpd 1.4.56 additionally supports a special case of lighttpd -1
(one-shot mode) with pipes on stdin and stdout, e.g. for use with a netcat
listener. The current lighttpd -1
expects a socket on stdin.
The solution was that they closed stdin in the program. You would just have to delete that section in the code and desock worked.