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.
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.
Example
GET HELP
or, if you want a list of all available items, use
GET KEYS
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
SET TEST Content-Length:10 abc defgh
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.
Example
UNSET TEST
BYE
Closes the connection.
DIE
Causes the server to die, losing all data.
RESTART
Causes the server to exec itself, losing all data.
CLONE
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 | |
by mdillon (Priest) on Jun 12, 2000 at 10:01 UTC | |
by Corion (Patriarch) on Jun 12, 2000 at 12:27 UTC |