Net::Server::HTTP
NAMETEST ONE LINER
SYNOPSIS
DESCRIPTION
METHODS
COMMAND LINE ARGUMENTS
TODO
AUTHOR
THANKS
SEE ALSO
POD ERRORS
NAME
Net::Server::HTTP − very basic Net::Server based HTTP server class
TEST ONE LINER
perl −e 'use Net::Server::HTTP; Net::Server::HTTP−>run(port=>8080)'
SYNOPSIS
use base qw(Net::Server::HTTP);
__PACKAGE__−>run;
sub process_http_request {
my $self = shift;
print "Content−type: text/html\n\n";
print "<form method=post action=/bam><input type=text name=foo><input type=submit></form>\n";
if (require Data::Dumper) {
local $Data::Dumper::Sortkeys = 1;
my $form = {};
if (require CGI) { my $q = CGI−>new; $form−>{$_} = $q−>param($_) for $q−>param; }
print "<pre>".Data::Dumper−>Dump([\%ENV, $form], ['*ENV', 'form'])."</pre>";
}
}
DESCRIPTION
Even though Net::Server::HTTP doesn’t fall into the normal parallel of the other Net::Server flavors, handling HTTP requests is an often requested feature and is a standard and simple protocol.
Net::Server::HTTP begins with base type MultiType defaulting to Net::Server::Fork. It is easy to change it to any of the other Net::Server flavors by passing server_type => $other_flavor in the server configurtation. The port has also been defaulted to port 80 − but could easily be changed to another through the server configuration.
METHODS
"process_http_request"
During this method, the %ENV will have been set to a standard CGI style environment. You will need to be sure to print the Content-type header. This is one change from the other standard Net::Server base classes.
During this method you can read from ENV and STDIN just like a normal HTTP request in other web servers. You can print to STDOUT and Net::Server will handle the header negotiation for you.
Note: Net::Server::HTTP has no concept of document root or script aliases or default handling of static content. That is up to the consumer of Net::Server::HTTP to work out.
Net::Server::HTTP comes with a basic ENV display installed as the default process_request method.
"process_request"
This method has been overridden in Net::Server::HTTP − you should not use it while using Net::Server::HTTP. This method parses the environment and sets up request alarms and handles dying failures. It calls process_http_request once the request is ready.
"send_status"
Takes an HTTP status and a message. Sends out the correct headers.
"send_501"
Calls send_status with 501 and the argument passed to send_501.
COMMAND LINE ARGUMENTS
In addition to
the command line arguments of the Net::Server base classes
you can also set the following options.
max_header_size
Defaults to 100_000. Maximum number of bytes to read while parsing headers.
server_revision
Defaults to Net::Server::HTTP/$Net::Server::VERSION.
timeout_header
Defaults to 15 − number of seconds to wait for parsing headers.
timeout_idle
Defaults to 60 − number of seconds a request can be idle before the request is closed.
TODO
Add support for writing out HTTP/1 .1.
AUTHOR
Paul T. Seamons paul@seamons.com
THANKS
See Net::Server
SEE ALSO
Please see also Net::Server::Fork, Net::Server::INET, Net::Server::PreFork, Net::Server::PreForkSimple, Net::Server::MultiType, Net::Server::Single Net::Server::SIG Net::Server::Daemonize Net::Server::Proto
POD ERRORS
Hey! The
above document had some coding errors, which are explained
below:
Around line 292:
You forgot a ’=back’ before ’=head1’
More Linux Commands
manpages/ldexpf.3.html
ldexpf(3) - multiply floating-point number by integral power
The ldexp() function returns the result of multiplying the floating-point number x by 2 raised to the power exp. RETURN VALUE On success, these functions return
manpages/getcchar.3ncurses.html
getcchar(3ncurses) - Get a wide character string and renditi
The getcchar function gets a wide-character string and rendition from a cchar_t argument. When wch is not a null pointer, the getcchar function does the followi
manpages/glutRemoveOverlay.3.html
glutRemoveOverlay(3) - removes the overlay (if one exists) f
glutRemoveOverlay removes the overlay (if one exists). It is safe to call glutRemoveOverlay even if no overlay is currently established--it does nothing in this
manpages/pkcs8.1ssl.html
pkcs8(1ssl) - PKCS#8 format private key conversion tool.....
The pkcs8 command processes private keys in PKCS#8 format. It can handle both unencrypted PKCS#8 PrivateKeyInfo format and EncryptedPrivateKeyInfo format with a
manpages/lsinitrd.8.html
lsinitrd(8) - lists contents of an initrd disk image........
lsinitrd list the contents of an initial ramdisk images for booting Linux as created by mkinitrd(8). OPTIONS -h Shows help output and exits. -l Verbose listing,
manpages/linefind.1.html
linefind(1) Detect vertical features in images (Man Page)...
linefind is a detector for vertical features in images. It tries to find vertical lines using the same algorithm as Calibrate_lens_gui and assigns vertical cont
manpages/DBD::File::Roadmap.3pm.html
DBD::File::Roadmap(3pm) - Planned Enhancements for DBD::File
This document gives a high level overview of the future of the DBD::File DBI driver and groundwork for pure Perl DBI drivers. The planned enhancements cover fea
manpages/mvwaddchnstr.3ncurses.html
mvwaddchnstr(3ncurses) - add a string of characters (and att
These functions copy the (null-terminated) chstr array into the window image structure starting at the current cursor position. The four functions with n as the
manpages/exec.n.html
exec(n) - Invoke subprocesses (Local - Linux man page)......
This command treats its arguments as the specification of one or more subprocesses to execute. The arguments take the form of a standard shell pipeline where ea
manpages/glutGetModifiers.3.html
glutGetModifiers(3) - returns the modifier key state when ce
glutGetModifiers returns the modifier key state at the time the input event for a keyboard, special, or mouse callback is generated. This routine may only be ca
manpages/avahi.service.5.html
avahi.service(5) - avahi-daemon static service file.........
/etc/avahi/services/*.service are XML fragments containing static DNS-SD service data. Every service file can contain multiple service definitions which share t
manpages/has_colors.3ncurses.html
has_colors(3ncurses) - curses color manipulation routines...
Overview curses support color attributes on terminals with that capability. To use these routines start_color must be called, usually right after initscr. Color
