NAME
Continuity::Adapt::HttpDaemon - Use HTTP::Daemon as a continuation server
DESCRIPTION
This is the default and reference adaptor for Continuity.
An adaptor interfaces between the continuation server (Continuity::Server) and the web server (HTTP::Daemon, FastCGI, etc).
This adapter adapts between an HTTP::Daemon server and Contuinity.
This module was designed to be subclassed to fine-tune behavior.
METHODS
$adapter = Continuity::Adapt::HttpDaemon->new(...)
Create a new continuation adaptor and HTTP::Daemon. This actually starts the HTTP server which is embeded. It takes the same arguments as the HTTP::Daemon module, and those arguments are passed along. It also takes the optional argument docroot => '/path'
. This adapter may then be specified for use with the following code:
my $server = Contuinity->new(adapter => $adapter);
get_request() - map a URL path to a filesystem path
Called in a loop from Contuinity::Server. Returns the empty list on failure, which aborts the server process. Aside from the constructor, this is the heart of this module.
Note that this method has a confusingly same name as get_request()
in Continuity. The get_request()
here is called from Continuity
and pulls down a raw HTTP::Request object without consideration other get_request()
is called by
$adapter->map_path($path)
Decodes URL-encoding in the path and attempts to guard against malice. Returns the processed path.
send_static($request)
Sends a static file off of the filesystem.
We cheat here... use 'magic' to get mimetype and send that followed by the contents of the file.
This may be obvious, but you can't send binary data as part of the same request that you've already sent text or HTML on, MIME aside.
SEE ALSO
AUTHOR
Brock Wilcox <awwaiid@thelackthereof.org>
http://thelackthereof.org/
COPYRIGHT
Copyright (c) 2004-2006 Brock Wilcox <awwaiid@thelackthereof.org>. All rights
reserved. This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.