3 ms·
Not as CGI is currently designed. Many components of the request, like the HTTP headers, request method, and path, get passed to the CGI script as environment v
by duskwuff 3y ago
Not as CGI is currently designed. Many components of the request, like the HTTP headers, request method, and path, get passed to the CGI script as environment variables.
You could redesign CGI to change this, of course. But at that point, you've lost compatibility with existing CGI scripts, and you might as well use FastCGI and/or HTTP over a socket instead.
- zokier 3y agoWith some hackery you might be able to do it even with plain CGI. I'm thinking doing something like user-land exec[1] and pausing the execution of child just before `main` (or whatever entrypoint). You still need to do one fork per request, but still you could improve average case latency by having children pre-forked. No, it absolutely would not be worthwhile to go through such hoops, but fun thought experiment. [1] https://news.ycombinator.com/item?id=37025843 https://news.ycombinator.com/item?id=37025843