in reply to Socket.pm nonblocking

I have a (small?) proof-of-concept-demo server I did, that was nonblocking, but this is a HTTP server (it also has push HTTP, I was thinking of using it as a shared database for volatile data like internet connection status and other status information of the network.

The server assumes that it can always gobble in a complete client request/client line at one time, I was too lazy to also implement blocking for reading and not only for writing... You will have to add a buffer there as well ... Or maybe I've added that too - I don't remember, as this code is about 1 year old ;)

The commands it has are "GET", "SET" and "UNSET" and some more, it has (if I remember right) even the possibility to access it with a "normal" http-browser, but it prefers clients that keep the connection open.

The code should work as-is on any OS, but if you are setting it up for public use, you will surely add use warnings; (which I do via the command line) and use strict; (which I didn't use back then).

Update : I added some documentation in the code, mainly around the select() statements (which aren't even select() but IO::Select statements ...).

Update : Thanks to mdillon for suggesting I put the /o modifier on the constant REs. Also, by looking again over the code, this code readily will execute arbitrary Perl code with the SOURCE command. While this allowed me to create cool commands/keys like WHO in cgi-bin fashion, this will be a major security issue for you (or maybe not, as you will have 10 clients on your server that could be well-behaved ...)

Update: I've moved the code into the Code Catacombs, it is now available (together with the ad-hoc documentation) at Push HTTP Server.

Update: Currently the link is broken because the code node has vanished. We are doing the necessary rituals for revivification of the node. Please stand by.

Replies are listed 'Best First'.
Documentation for the above "http" server
by Corion (Patriarch) on Jun 10, 2000 at 20:15 UTC

    I was stupid again and instead of asking vroom to simply move this node, I created a new node with the documentation here. Stupid me. D'oh. Sorry for the inconvenience.