Sanada (2003-11-26)

HTTP server.


perl <file> [port] [type]

   <file>   Name of file to serve.
            Clients can specify any URL and still get the same file,
            although they would always need to use the same name for
            resume to work.

   [port]   The TCP port number to listen on, default is 80.
            Usually, Sanada-san won't be able to bind to ports below
            1024, and you would need to specify an alternate port.

   [type]   Content type of file, default is application/octet-stream.
            The default type works for all binary file transfers.
            Other types can be specified to be more client friendly,
            e.g.  image/jpeg, text/plain.

Sanada-san can resume partial downloads.  That is, limited
implementation of RFC2616 14.35.1, just enough so that "wget -c"
works.  For clients that specify complex ranges (I don't have any that
I can test with), Sanada-san will probably return error 416.

Sanada-san can handle multiple clients.  On platforms that supports it
(linux, cygwin), Sanada-san will fork off a new process for each

On broken downloads, Sanada-san will prefix bytes served by '~',
indicating approximately how many bytes are sent.  This is always an
overestimate due to buffering.  For downloads near completion (or when
serving small files), it will always appear as if the file was sent

All URLs lead to the same file, clients will never receive 404 error.
For most clients though, the local file name is determined by the URL,
e.g. http://ip:port/<filename> will create a file named <filename>,
thus the clients will need to use the same filename to write/resume
the same file.

Send ctrl+c (SIGINT) to kill server.

Client IP/port/agent/referrer are printed to stdout, where available.
Thus you can redirect stdout for manual logging.

To serve multiple files on multipe ports, use <firstport> <type> <files...>

... which is really with some more forking and signal
handling functions.  Anything more complicated and you should run a
real HTTP server like Apache ^_^;

Sanada-san is from UFO Princess Valkyrie (enban koujo valkyrie).
Service Chief Sanada-san is a HTTP server.  It's an obscure joke ^_^;

-- -