Revision [1000]

This is an old revision of CommandHttpserver made by DavidLee on 2009-11-25 10:12:45.

 

Command httpserver


Name

httpserver http server

Synopsis

httpserver [options] [start|stop]

This command is still under development and is expected to change substantially.

Httpserver starts or stops a single thread which runs an HTTP server within the current shell.
The server is run as a background thread so the command returns immedeately.
Processing of requests is entirely scripted.


Options


-port portListen on the specified port (default 80)
-context pathResponds to requests on the given context (default "/")
-get cmdExecutes cmd when handling a GET request
-put cmdExecutes cmd when handling a PUT request
-post cmd Executes cmd when handling a POST request
-chunkOperates in HTTP Chunked mode (default is off)

startStarts the HTTP server
stopStops the HTTP server


Usage


On invocation of a method, $1 is set to the file part of the URI, $2 is set to the query portion of the URI.
The HTTP Request body is made available as stdin to the command, and the output of the command becomes the Response portion.




Examples


Start a server that serves the file specified by the URL given.
import commands posix
httpserver -port 80 -get 'cat $(xfile . $1)' start





Return Value





Commands
CategoryCommands
CommandsExperimental

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki