Is there an example of sending HTTP response asynchronously?
bharat42 opened this issue · comments
In my implementation, for every HTTP request received, I need to make an asynchronous HTTP request to a remote server. I need to wait till the response is received from that remote server before I return a status code in my Lwan request handler function.
Instead of returning a status from the handler function, I was expecting to call a function like "lwan_send_response" with content as param once my handler is ready to send the response.
There's no way, right now, to perform something like this efficiently. The only way, right now, is to use non-blocking sockets, and spin on a call to read(), yielding whenever read() returns -EAGAIN. Work on this has started, though, and it's partially implemented (to allow e.g. corooutines to sleep), but I haven't progressed much beyond what's on the tree right now.