Hacker News new | ask | show | jobs
by guntars 1734 days ago
Not sure I follow. A reasonable framework would stream both the incoming request as well as the response. If the WASM module wants to read the whole thing into memory, it's free to do so, but you could have it process the request piecemeal. It's just reading the request from a file descriptor and writing the response to another one. Not that different when those fds are actually sockets.
1 comments

Oh sorry. I misread it and thought you are asking why the request isn’t passed in complete form as an environment variable too. I guess you are asking why the request headers are not transferred via stdin too? My guess it’s just because that’s how CGI works. It prevents from having apps do the parsing work. Plus what could be passed wouldn’t be the original request anyway. If the Webserver handles http2 or http3 headers would always need to be repacked into a format that the script understands.