[Bps-public-commit] r17004 - in HTTP-Server-Simple: . lib/HTTP/Server/Simple lib/HTTP/Server/Simple/CGI
alexmv at bestpractical.com
alexmv at bestpractical.com
Sun Nov 23 01:51:15 EST 2008
Author: alexmv
Date: Sun Nov 23 01:51:14 2008
New Revision: 17004
Modified:
HTTP-Server-Simple/ (props changed)
HTTP-Server-Simple/Changes
HTTP-Server-Simple/META.yml
HTTP-Server-Simple/Makefile.PL
HTTP-Server-Simple/SIGNATURE
HTTP-Server-Simple/lib/HTTP/Server/Simple.pm
HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI.pm
HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm
Log:
r39414 at kohr-ah: chmrr | 2008-11-23 01:51:04 -0500
* Minor documentation fixups
* 0.36 releng
Modified: HTTP-Server-Simple/Changes
==============================================================================
--- HTTP-Server-Simple/Changes (original)
+++ HTTP-Server-Simple/Changes Sun Nov 23 01:51:14 2008
@@ -1,3 +1,7 @@
+0.36
+
+* Documentation fixups
+
0.35
* Pass arguments to ->run through to Net::Server->run
Modified: HTTP-Server-Simple/META.yml
==============================================================================
--- HTTP-Server-Simple/META.yml (original)
+++ HTTP-Server-Simple/META.yml Sun Nov 23 01:51:14 2008
@@ -16,4 +16,4 @@
Socket: 0
Test::More: 0
URI::Escape: 0
-version: 0.31
+version: 0.36
Modified: HTTP-Server-Simple/Makefile.PL
==============================================================================
--- HTTP-Server-Simple/Makefile.PL (original)
+++ HTTP-Server-Simple/Makefile.PL Sun Nov 23 01:51:14 2008
@@ -3,11 +3,11 @@
version_from('lib/HTTP/Server/Simple.pm');
name('HTTP-Server-Simple');
license('perl');
-requires ( Socket => 0,
- Test::More => 0,
- CGI => 0,
- URI::Escape => 0
- );
-
- &WriteAll;
+requires(
+ Socket => 0,
+ Test::More => 0,
+ CGI => 0,
+ URI::Escape => 0
+);
+WriteAll();
Modified: HTTP-Server-Simple/SIGNATURE
==============================================================================
--- HTTP-Server-Simple/SIGNATURE (original)
+++ HTTP-Server-Simple/SIGNATURE Sun Nov 23 01:51:14 2008
@@ -14,10 +14,10 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 7b03368caeaf04a1584735e0fe874d4008fc84e6 Changes
+SHA1 af311b6f977e690ad39ff86b71e6d3bb611b7d6a Changes
SHA1 0ac508c50476dcc2bf8fe3094cb341425291e1ee MANIFEST
-SHA1 7812a1c898acbf76fcccb52068b2a9c23cb86bbf META.yml
-SHA1 3a02ba613b11b07dd1fa97e2a6b962ee3e039c98 Makefile.PL
+SHA1 cf3198cef8524b06b0f6df065b577225caf74a69 META.yml
+SHA1 1e68273869351212220429a4860ce710d5f3e291 Makefile.PL
SHA1 ed0c107672daac3bc9e266876666e1059dbe44b7 README
SHA1 4ea1e9072ca87399184a46233df52a21e285604d ex/sample_server
SHA1 7e2cfa1b9efe0d502ee57717649c90ba4bd28ba9 inc/Module/Install.pm
@@ -28,9 +28,9 @@
SHA1 7d3be9b158e37b2b2c22084740099955623b1d56 inc/Module/Install/Metadata.pm
SHA1 0a8b66180229ba2f9deaea1fedd0aacf7a7ace6b inc/Module/Install/Win32.pm
SHA1 d3352eb33fe43a5f3ead513f645224fe34d73bc9 inc/Module/Install/WriteAll.pm
-SHA1 25a12297b6480dc17861d2c294dd8357732d6350 lib/HTTP/Server/Simple.pm
-SHA1 40f24374f2b5845a3025e14ca4b91bd58298de03 lib/HTTP/Server/Simple/CGI.pm
-SHA1 99ec6998826486bbc5775b222408e6baf40dc885 lib/HTTP/Server/Simple/CGI/Environment.pm
+SHA1 47c1b14c60d44388818e99b86f58d3a688e6f7a1 lib/HTTP/Server/Simple.pm
+SHA1 3ddd188b0ee926a7e114e711b88c0af69b9a9079 lib/HTTP/Server/Simple/CGI.pm
+SHA1 56e2d88c9a3ddd3b264d86279a52c099bbffa8f4 lib/HTTP/Server/Simple/CGI/Environment.pm
SHA1 db064af54cab345a71daec576e32e64b8fb1033d t/00smoke.t
SHA1 c58cc41a260213d9aeb4bed7b6c2926a37a3402a t/01live.t
SHA1 aca95653cfce68912e08c57b3a4566207e2f99b3 t/02pod.t
@@ -39,7 +39,7 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
-iEYEARECAAYFAkjb9vEACgkQMflWJZZAbqBJfQCfanhxRlw+b1pXLDn5kG1Dztqs
-hxEAoKrQOkRZMbMmtf5otR/k5WuEgyFl
-=XzP2
+iEYEARECAAYFAkko/RgACgkQMflWJZZAbqAOHwCgmAefircgIQo/xfW4s32oRUpV
+f5kAoIJYFbQn+PhGq0Nb0l23P1M5AHBs
+=KgDS
-----END PGP SIGNATURE-----
Modified: HTTP-Server-Simple/lib/HTTP/Server/Simple.pm
==============================================================================
--- HTTP-Server-Simple/lib/HTTP/Server/Simple.pm (original)
+++ HTTP-Server-Simple/lib/HTTP/Server/Simple.pm Sun Nov 23 01:51:14 2008
@@ -8,14 +8,12 @@
use URI::Escape;
use vars qw($VERSION $bad_request_doc);
-$VERSION = '0.35';
-
+$VERSION = '0.36';
=head1 NAME
HTTP::Server::Simple - Lightweight HTTP server
-
=head1 SYNOPSIS
use warnings;
@@ -44,14 +42,13 @@
=head1 DESCRIPTION
-This is a simple standalone HTTP server. By default, it doesn't thread
-or fork.
-
-It does, however, act as a simple frontend which can be used
+This is a simple standalone HTTP server. By default, it doesn't thread
+or fork. It does, however, act as a simple frontend which can be used
to build a standalone web-based application or turn a CGI into one.
-(It's possible to use Net::Server to get threading, forking,
-preforking and so on. Autrijus Tang wrote the functionality and owes docs for that ;)
+It is possible to use L<Net::Server> classes to create forking,
+pre-forking, and other types of more complicated servers; see
+L</net_server>.
By default, the server traps a few signals:
@@ -70,7 +67,7 @@
If the server detects a broken pipe while writing output to the client,
it ignores the signal. Otherwise, a client closing the connection early
-could kill the server
+could kill the server.
=back
@@ -126,12 +123,12 @@
my $pid = MyWebServer->new(8080)->background();
print "Use 'kill $pid' to stop server.\n";
-=head1 METHODS
+=head1 METHODS
=head2 HTTP::Server::Simple->new($port)
API call to start a new server. Does not actually start listening
-until you call C<-E<gt>run()>.
+until you call C<-E<gt>run()>. If omitted, C<$port> defaults to 8080.
=cut
@@ -148,19 +145,14 @@
bless( $self, $class );
$self->port( $port || '8080' );
-
-
return $self;
}
=head2 lookup_localhost
-Looks up the local host's hostname and IP address.
-
-Stuffs them into
-
-$self->{'localname'} and $self->{'localaddr'}
+Looks up the local host's IP address, and returns it. For most hosts,
+this is C<127.0.0.1>.
=cut
@@ -174,8 +166,6 @@
}
-
-
=head2 port [NUMBER]
Takes an optional port number for this server to listen on.
@@ -207,9 +197,10 @@
}
-=head2 background
+=head2 background [ARGUMENTS]
-Run the server in the background. returns pid.
+Runs the server in the background, and returns the process ID of the
+started process. Any arguments will be passed through to L</run>.
=cut
@@ -227,10 +218,12 @@
$self->run(@_);
}
-=head2 run
+=head2 run [ARGUMENTS]
Run the server. If all goes well, this won't ever return, but it will
-start listening for http requests.
+start listening for C<HTTP> requests. Any arguments passed to this
+will be passed on to the underlying L<Net::Server> implementation, if
+one is used (see L</net_server>).
=cut
@@ -278,8 +271,8 @@
=head2 net_server
-User-overridable method. If you set it to a C<Net::Server> subclass,
-that subclass is used for the C<run> method. Otherwise, a minimal
+User-overridable method. If you set it to a L<Net::Server> subclass,
+that subclass is used for the C<run> method. Otherwise, a minimal
implementation is used as default.
=cut
@@ -404,13 +397,9 @@
$self->post_setup_hook if $self->can("post_setup_hook");
$self->handler;
- }
+ }
}
-
-
-
-
=head2 stdio_handle [FILEHANDLE]
When called with an argument, sets the socket to the server to that arg.
@@ -430,9 +419,9 @@
=head2 stdin_handle
-Returns a filehandle used for input from the client. By default,
-returns whatever was set with C<stdio_handle>, but a subclass
-could do something interesting here (see L<HTTP::Server::Simple::Logger>).
+Returns a filehandle used for input from the client. By default,
+returns whatever was set with C<stdio_handle>, but a subclass could do
+something interesting here.
=cut
@@ -445,7 +434,7 @@
Returns a filehandle used for output to the client. By default,
returns whatever was set with C<stdio_handle>, but a subclass
-could do something interesting here (see L<HTTP::Server::Simple::Logger>).
+could do something interesting here.
=cut
@@ -538,10 +527,9 @@
my $headers = shift;
my $can_header = $self->can("header");
+ return unless $can_header;
while ( my ( $header, $value ) = splice @$headers, 0, 2 ) {
- if ($can_header) {
- $self->header( $header => $value );
- }
+ $self->header( $header => $value );
}
}
@@ -596,11 +584,8 @@
=head2 parse_request
-Parse the HTTP request line.
-
-Returns three values, the request method, request URI and the protocol
-Sub-classed versions of this should return three values - request
-method, request URI and proto
+Parse the HTTP request line. Returns three values, the request
+method, request URI and the protocol.
=cut
@@ -624,13 +609,9 @@
=head2 parse_headers
-Parse incoming HTTP headers from STDIN.
-
-Remember, this is a B<simple> HTTP server, so nothing intelligent is
-done with them C<:-)>.
-
-This should return an ARRAY ref of C<(header =E<gt> value)> pairs
-inside the array.
+Parses incoming HTTP headers from STDIN, and returns an arrayref of
+C<(header =E<gt> value)> pairs. See L</headers> for possibilities on
+how to inspect headers.
=cut
@@ -685,7 +666,8 @@
=head2 after_setup_listener
-This method is called immediately after setup_listener. It's here just for you to override.
+This method is called immediately after setup_listener. It's here just
+for you to override.
=cut
@@ -712,7 +694,9 @@
=head2 valid_http_method($method)
Given a candidate HTTP method in $method, determine if it is valid.
-Override if, for example, you'd like to do some WebDAV.
+Override if, for example, you'd like to do some WebDAV. The default
+implementation only accepts C<GET>, C<POST>, C<HEAD>, C<PUT>, and
+C<DELETE>.
=cut
Modified: HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI.pm
==============================================================================
--- HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI.pm (original)
+++ HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI.pm Sun Nov 23 01:51:14 2008
@@ -35,7 +35,8 @@
=head2 post_setup_hook
-
+Initializes the global L<CGI> object, as well as other environment
+settings.
=cut
Modified: HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm
==============================================================================
--- HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm (original)
+++ HTTP-Server-Simple/lib/HTTP/Server/Simple/CGI/Environment.pm Sun Nov 23 01:51:14 2008
@@ -16,9 +16,9 @@
=head1 DESCRIPTION
-This mixin abstracts the CGI protocol out from HTTP::Server::Simple::CGI so that
-it's easier to provide your own CGI handlers with HTTP::Server::Simple which
-B<don't> use CGI.pm
+This mixin abstracts the CGI protocol out from
+L<HTTP::Server::Simple::CGI> so that it's easier to provide your own
+CGI handlers with L<HTTP::Server::Simple> which B<don't> use CGI.pm
=head2 setup_environment
@@ -39,7 +39,7 @@
=head2 setup_server_url
-Sets up the SERVER_URL environment variable
+Sets up the C<SERVER_URL> environment variable
=cut
More information about the Bps-public-commit
mailing list