Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Push HTTP server documentation

by Corion (Pope)
on Jun 10, 2000 at 20:47 UTC ( #17517=note: print w/replies, xml ) Need Help??

in reply to Push HTTP server

mdillon gave this source code a deeper look and complained about the documentation or, more exact, the lack thereof. So I write this node to document the features of the above server a bit, that all of you might play with it.


This httpd server saw light as a proof-of-concept server for a database with highly volatile data. Such data was mostly read-only access from for example the status of the dial-up connection or the calling-party number. It was assumed that no locking of entries would be necessary as there would be only one defined writer for each node and rapid updating would be always possible.

Command set

The command set was more or less oriented at what http 1.1 provided, but also allows for server-side notification of clients so that constant polling would be unnecessary.

GET itemname
Gets an item. This format allows even a normal HTML browser to view the data.
or, if you want a list of all available items, use


SET itemname
Sets data for an item. You must supply the Content-Length: in the request and then send the data after it Example
SET TEST 123456
or, if you want to store multi-line data


UNSET itemname
Erases an item. Pooof. Some items, notably those whose name is in the %Readonly hash, cannot be erased except through a direct Perl statement.

Closes the connection.

Causes the server to die, losing all data.

Causes the server to exec itself, losing all data.

Causes the server to save all data to a file and then restart itself from that file, thus preserving all data.

SOURCE itemname
Executes the Perl code stored in itemname and returns what the code returned. This is a major security hole but very convenient if you want to add highly dynamic items to the server on the fly.
Example (courtesy of mdillon)

SET passwd `cat /etc/passwd`
SOURCE passwd

The purpose of this command was to faciliate populating the %Status hash with new code, like the code for the KEYS item or the WHO item. Example

SET code
Content-Length: ??? <-- fix this
sub return_test{
  return join(" ", keys %SpecialHash );
$Status{test} = \&return_test;
This would add a new item, test, that executes the code stored in &return_test every time the item is requested.

Replies are listed 'Best First'.
RE: Push HTTP server documentation
by gregorovius (Friar) on Jun 12, 2000 at 09:53 UTC
    Cool program. I recently reviewed some code to do similar stuff with java. The interesting part was that they had a tiny applet client hidden in a webpage that held persistant connections to their server. This client had the abilty to 'instruct' the host browser to reload a page (via some java-javascript browser calls) every time the server instructed it to do so. It occurs to me that maybe you could develop a similar client to retrofit the functionality you want to existing browsers. Also, do you have a client to demonstrate the persistant connections that you could show us?

      'telnet localhost 9000' should work on almost any platform.

      just type in the commands manually, since they're pretty simple and there aren't too many of them.

      there is also a utility called netcat that is available for most operating systems that will let you do stuff like this:

      echo "GET HELP" | nc localhost 9000

      netcat is available here.

      The "official" position is, that the only such client is telnet, and telnet localhost 9000 in several windows lets you test the multi-user "features" (and bugs) quite well.

      I'm not really fit with Java, in fact, I haven't programmed a single line in it, but I'm interested in that persistent connection feature - do you have any pointers where I could look for the right classes to use ? I imagine a remote control/remote panel for a mp3 player that also has status, progress etc. for multiple computers (wired home).

      After talking to some Java wizard who told me that Java vs. Javascript interaction was not as easy as I thought, I'm thinking of actually writing a specialized client (in Perl), that embeds IE to render the HTML - maybe easier than doing it backwards by using IE to download non-http data ;).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://17517]
[MidLifeXis]: Nothing like encouraging the success of a rollout by neutering your current support structure without a reasonable staffed and trained replacement structure.
[MidLifeXis]: Speaking of which, anyone know of Perl positions in the MKE area (or slightly west)?
[Corion]: MidLifeXis: Oh, enjoying the show from the sidelines I see...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2017-03-23 12:31 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (286 votes). Check out past polls.