Handling of the non-blocking sockets is not the issue, data from each client already flows beautifully into buffers thanks to IO::Select/sysread/syswrite and that bit works like a charm. It's just that I have about 60-70 lines of code just to grab HTTP requests from those buffers and besides being an eyesore I'm pretty sure it will fall over pretty soon if exposed to the real world.
The main loop for each client/server socket pair kind of goes like this:
- Read from sockets that can be read from
- Fill inspection buffer with data from client
- If a buffer has been modified, see if it contains a HTTP request, complete with content (possibly chunked)
- If a HTTP request was found, remove it from the inspection buffer and allow/deny it
- Write allowed data to sockets that can be written to
This is for SSL inspection if you didn't already guess, the prototype works but I'm trying to make it more robust.
--
FloydATC
I got 99 problems, most of them have to do with printers.