Debian Codegraph @

lib/HTTP/Server/Simple.pm

raw ◀ ▶
Source reconstructed at patch state 1 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 use strict;
2 use warnings;
3
4 package HTTP::Server::Simple;
5 use FileHandle;
6 use Socket;
7 use Carp;
8 use IO::Select;
9
10 use vars qw($VERSION $bad_request_doc);
11 $VERSION = '0.52';
12
13 =head1 NAME
14
15 HTTP::Server::Simple - Lightweight HTTP server
16
17 =head1 SYNOPSIS
18
19 use warnings;
20 use strict;
21
22 use HTTP::Server::Simple;
23
24 my $server = HTTP::Server::Simple->new();
25 $server->run();
26
27 However, normally you will sub-class the HTTP::Server::Simple::CGI
28 module (see L<HTTP::Server::Simple::CGI>);
29
30 package Your::Web::Server;
31 use base qw(HTTP::Server::Simple::CGI);
32
33 sub handle_request {
34 my ($self, $cgi) = @_;
35
36 #... do something, print output to default
37 # selected filehandle...
38
39 }
40
41 1;
42
43 =head1 DESCRIPTION
44
45 This is a simple standalone HTTP server. By default, it doesn't thread
46 or fork. It does, however, act as a simple frontend which can be used
47 to build a standalone web-based application or turn a CGI into one.
48
49 It is possible to use L<Net::Server> classes to create forking,
50 pre-forking, and other types of more complicated servers; see
51 L</net_server>.
52
53 By default, the server traps a few signals:
54
55 =over
56
57 =item HUP
58
59 When you C<kill -HUP> the server, it lets the current request finish being
60 processed, then uses the C<restart> method to re-exec itself. Please note that
61 in order to provide restart-on-SIGHUP, HTTP::Server::Simple sets a SIGHUP
62 handler during initialisation. If your request handling code forks you need to
63 make sure you reset this or unexpected things will happen if somebody sends a
64 HUP to all running processes spawned by your app (e.g. by "kill -HUP <script>")
65
66 =item PIPE
67
68 If the server detects a broken pipe while writing output to the client,
69 it ignores the signal. Otherwise, a client closing the connection early
70 could kill the server.
71
72 =back
73
74 =head1 EXAMPLE
75
76 #!/usr/bin/perl
77 {
78 package MyWebServer;
79
80 use HTTP::Server::Simple::CGI;
81 use base qw(HTTP::Server::Simple::CGI);
82
83 my %dispatch = (
84 '/hello' => \&resp_hello,
85 # ...
86 );
87
88 sub handle_request {
89 my $self = shift;
90 my $cgi = shift;
91
92 my $path = $cgi->path_info();
93 my $handler = $dispatch{$path};
94
95 if (ref($handler) eq "CODE") {
96 print "HTTP/1.0 200 OK\r\n";
97 $handler->($cgi);
98
99 } else {
100 print "HTTP/1.0 404 Not found\r\n";
101 print $cgi->header,
102 $cgi->start_html('Not found'),
103 $cgi->h1('Not found'),
104 $cgi->end_html;
105 }
106 }
107
108 sub resp_hello {
109 my $cgi = shift; # CGI.pm object
110 return if !ref $cgi;
111
112 my $who = $cgi->param('name');
113
114 print $cgi->header,
115 $cgi->start_html("Hello"),
116 $cgi->h1("Hello $who!"),
117 $cgi->end_html;
118 }
119
120 }
121
122 # start the server on port 8080
123 my $pid = MyWebServer->new(8080)->background();
124 print "Use 'kill $pid' to stop server.\n";
125
126 =head1 METHODS
127
128 =head2 HTTP::Server::Simple->new($port, $family)
129
130 API call to start a new server. Does not actually start listening
131 until you call C<-E<gt>run()>. If omitted, C<$port> defaults to 8080,
132 and C<$family> defaults to L<Socket::AF_INET>.
133 The alternative domain is L<Socket::AF_INET6>.
134
135 =cut
136
137 sub new {
138 my ( $proto, $port, $family ) = @_;
139 my $class = ref($proto) || $proto;
140
141 if ( $class eq __PACKAGE__ ) {
142 require HTTP::Server::Simple::CGI;
143 return HTTP::Server::Simple::CGI->new( @_[ 1 .. $#_ ] );
144 }
145
146 my $self = {};
147 bless( $self, $class );
148 $self->port( $port || '8080' );
149 $self->family( $family || AF_INET );
150
151 return $self;
152 }
153
154
155 =head2 lookup_localhost
156
157 Looks up the local host's IP address, and returns it. For most hosts,
158 this is C<127.0.0.1>, or possibly C<::1>.
159
160 =cut
161
162 sub lookup_localhost {
163 my $self = shift;
164
165 my $local_sockaddr = getsockname( $self->stdio_handle );
166 my $local_family = sockaddr_family($local_sockaddr);
167
168 my ($host_err,$local_host, undef) = Socket::getnameinfo($local_sockaddr,0);
169 warn $host_err if ($host_err);
170 $self->host( $local_host || "localhost");
171
172 my ($addr_err,$local_addr,undef) = Socket::getnameinfo($local_sockaddr,Socket::NI_NUMERICHOST);
173 warn $addr_err if ($addr_err);
174 $self->{'local_addr'} = $local_addr
175 || (($local_family == AF_INET6) ? "::1" : "127.0.0.1");
176 }
177
178
179 =head2 port [NUMBER]
180
181 Takes an optional port number for this server to listen on.
182
183 Returns this server's port. (Defaults to 8080)
184
185 =cut
186
187 sub port {
188 my $self = shift;
189 $self->{'port'} = shift if (@_);
190 return ( $self->{'port'} );
191
192 }
193
194 =head2 family [NUMBER]
195
196 Takes an optional address family for this server to use. Valid values
197 are Socket::AF_INET and Socket::AF_INET6. All other values are silently
198 changed into Socket::AF_INET for backwards compatibility with previous
199 versions of the module.
200
201 Returns the address family of the present listening socket. (Defaults to
202 Socket::AF_INET.)
203
204 =cut
205
206 sub family {
207 my $self = shift;
208 if (@_) {
209 if ($_[0] == AF_INET || $_[0] == AF_INET6) {
210 $self->{'family'} = shift;
211 } else {
212 $self->{'family'} = AF_INET;
213 }
214 }
215 return ( $self->{'family'} );
216
217 }
218
219 =head2 host [address]
220
221 Takes an optional host address for this server to bind to.
222
223 Returns this server's bound address (if any). Defaults to C<undef>
224 (bind to all interfaces).
225
226 =cut
227
228 sub host {
229 my $self = shift;
230 $self->{'host'} = shift if (@_);
231 return ( $self->{'host'} );
232
233 }
234
235 =head2 background [ARGUMENTS]
236
237 Runs the server in the background, and returns the process ID of the
238 started process. Any arguments will be passed through to L</run>.
239
240 =cut
241
242 sub background {
243 my $self = shift;
244
245 # set up a pipe so the child can tell the parent when it's ready
246 # to accept requests
247 my ($readfh, $writefh) = FileHandle::pipe;
248
249 my $child = fork;
250 croak "Can't fork: $!" unless defined($child);
251
252 if ($child) { # parent
253 my $s = IO::Select->new;
254 $s->add($readfh);
255 my $now = time; my $left = 0;
256 my @ready;
257 while(not @ready and $left < 5) {
258 @ready = $s->can_read($left);
259 $left = time - $now;
260 }
261 die("child unresponsive for 5 seconds") if(not @ready);
262 my $response = <$readfh>;
263 chomp $response;
264 die("child is confused: answer '$response' != 'OK'")
265 if $response ne "OK";
266 return $child;
267 }
268
269 srand(); # after a fork, we need to reset the random seed
270 # or we'll get the same numbers in both branches
271 if ( $^O !~ /MSWin32/ ) {
272 require POSIX;
273 POSIX::setsid()
274 or croak "Can't start a new session: $!";
275 }
276
277 $self->{_parent_handle} = $writefh;
278 $self->run(@_); # should never return
279 exit; # just to be sure
280 }
281
282 =head2 run [ARGUMENTS]
283
284 Run the server. If all goes well, this won't ever return, but it will
285 start listening for C<HTTP> requests. Any arguments passed to this
286 will be passed on to the underlying L<Net::Server> implementation, if
287 one is used (see L</net_server>).
288
289 =cut
290
291 my $server_class_id = 0;
292
293 use vars '$SERVER_SHOULD_RUN';
294 $SERVER_SHOULD_RUN = 1;
295
296 sub run {
297 my $self = shift;
298 my $server = $self->net_server;
299
300 local $SIG{CHLD} = 'IGNORE'; # reap child processes
301
302 # $pkg is generated anew for each invocation to "run"
303 # Just so we can use different net_server() implementations
304 # in different runs.
305 my $pkg = join '::', ref($self), "NetServer" . $server_class_id++;
306
307 no strict 'refs';
308 *{"$pkg\::process_request"} = $self->_process_request;
309
310 if ($server) {
311 require join( '/', split /::/, $server ) . '.pm';
312 *{"$pkg\::ISA"} = [$server];
313
314 # clear the environment before every request
315 require HTTP::Server::Simple::CGI;
316 *{"$pkg\::post_accept"} = sub {
317 HTTP::Server::Simple::CGI::Environment->setup_environment;
318 # $self->SUPER::post_accept uses the wrong super package
319 $server->can('post_accept')->(@_);
320 };
321 }
322 else {
323 $self->setup_listener;
324 $self->after_setup_listener();
325 *{"$pkg\::run"} = $self->_default_run;
326 }
327 $self->_maybe_tell_parent();
328
329 local $SIG{HUP} = sub { $SERVER_SHOULD_RUN = 0; };
330
331 $pkg->run( port => $self->port, @_ );
332 }
333
334 =head2 net_server
335
336 User-overridable method. If you set it to a L<Net::Server> subclass,
337 that subclass is used for the C<run> method. Otherwise, a minimal
338 implementation is used as default.
339
340 =cut
341
342 sub net_server {undef}
343
344 sub _default_run {
345 my $self = shift;
346
347 # Default "run" closure method for a stub, minimal Net::Server instance.
348 return sub {
349 my $pkg = shift;
350
351 $self->print_banner;
352
353 while ($SERVER_SHOULD_RUN) {
354 local $SIG{PIPE} = 'IGNORE'; # If we don't ignore SIGPIPE, a
355 # client closing the connection before we
356 # finish sending will cause the server to exit
357 while ( accept( my $remote = new FileHandle, HTTPDaemon ) ) {
358 $self->stdio_handle($remote);
359 $self->lookup_localhost() unless ($self->host);
360 $self->accept_hook if $self->can("accept_hook");
361
362
363 *STDIN = $self->stdin_handle();
364 *STDOUT = $self->stdout_handle();
365 select STDOUT; # required for HTTP::Server::Simple::Recorder
366 # XXX TODO glasser: why?
367 $pkg->process_request;
368 close $remote;
369 }
370 }
371
372 # Got here? Time to restart, due to SIGHUP
373 $self->restart;
374 };
375 }
376
377 =head2 restart
378
379 Restarts the server. Usually called by a HUP signal, not directly.
380
381 =cut
382
383 sub restart {
384 my $self = shift;
385
386 close HTTPDaemon;
387
388 $SIG{CHLD} = 'DEFAULT';
389 wait;
390
391 ### if the standalone server was invoked with perl -I .. we will loose
392 ### those include dirs upon re-exec. So add them to PERL5LIB, so they
393 ### are available again for the exec'ed process --kane
394 use Config;
395 $ENV{PERL5LIB} .= join $Config{path_sep}, @INC;
396
397 # Server simple
398 # do the exec. if $0 is not executable, try running it with $^X.
399 exec {$0}( ( ( -x $0 ) ? () : ($^X) ), $0, @ARGV );
400 }
401
402
403 sub _process_request {
404 my $self = shift;
405
406 # Create a callback closure that is invoked for each incoming request;
407 # the $self above is bound into the closure.
408 sub {
409
410 $self->stdio_handle(*STDIN) unless $self->stdio_handle;
411
412 # Default to unencoded, raw data out.
413 # if you're sending utf8 and latin1 data mixed, you may need to override this
414 binmode STDIN, ':raw';
415 binmode STDOUT, ':raw';
416
417 # The ternary operator below is to protect against a crash caused by IE
418 # Ported from Catalyst::Engine::HTTP (Originally by Jasper Krogh and Peter Edwards)
419 # ( http://dev.catalyst.perl.org/changeset/5195, 5221 )
420
421 my $remote_sockaddr = getpeername( $self->stdio_handle );
422 my $family = sockaddr_family($remote_sockaddr);
423
424 my ( $iport, $iaddr ) = $remote_sockaddr
425 ? ( ($family == AF_INET6) ? sockaddr_in6($remote_sockaddr)
426 : sockaddr_in($remote_sockaddr) )
427 : (undef,undef);
428
429 my $loopback = ($family == AF_INET6) ? "::1" : "127.0.0.1";
430 my $peeraddr = $loopback;
431 if ($iaddr) {
432 my ($host_err,$addr, undef) = Socket::getnameinfo($remote_sockaddr,Socket::NI_NUMERICHOST);
433 warn ($host_err) if $host_err;
434 $peeraddr = $addr || $loopback;
435 }
436
437
438 my ( $method, $request_uri, $proto ) = $self->parse_request;
439
440 unless ($self->valid_http_method($method) ) {
441 $self->bad_request;
442 return;
443 }
444
445 $proto ||= "HTTP/0.9";
446
447 my ( $file, $query_string )
448 = ( $request_uri =~ /([^?]*)(?:\?(.*))?/s ); # split at ?
449
450 $self->setup(
451 method => $method,
452 protocol => $proto,
453 query_string => ( defined($query_string) ? $query_string : '' ),
454 request_uri => $request_uri,
455 path => $file,
456 localname => $self->host,
457 localport => $self->port,
458 peername => $peeraddr,
459 peeraddr => $peeraddr,
460 peerport => $iport,
461 );
462
463 # HTTP/0.9 didn't have any headers (I think)
464 if ( $proto =~ m{HTTP/(\d(\.\d)?)$} and $1 >= 1 ) {
465
466 my $headers = $self->parse_headers
467 or do { $self->bad_request; return };
468
469 $self->headers($headers);
470
471 }
472
473 $self->post_setup_hook if $self->can("post_setup_hook");
474
475 $self->handler;
476 }
477 }
478
479 sub _maybe_tell_parent {
480 # inform the parent process that we're ready, if applicable
481 my $self = shift;
482 my $handle = $self->{_parent_handle};
483 return if !$handle;
484 print $handle "OK\n";
485 close $handle;
486 delete $self->{_parent_handle};
487 }
488
489 =head2 stdio_handle [FILEHANDLE]
490
491 When called with an argument, sets the socket to the server to that arg.
492
493 Returns the socket to the server; you should only use this for actual socket-related
494 calls like C<getsockname>. If all you want is to read or write to the socket,
495 you should use C<stdin_handle> and C<stdout_handle> to get the in and out filehandles
496 explicitly.
497
498 =cut
499
500 sub stdio_handle {
501 my $self = shift;
502 $self->{'_stdio_handle'} = shift if (@_);
503 return $self->{'_stdio_handle'};
504 }
505
506 =head2 stdin_handle
507
508 Returns a filehandle used for input from the client. By default,
509 returns whatever was set with C<stdio_handle>, but a subclass could do
510 something interesting here.
511
512 =cut
513
514 sub stdin_handle {
515 my $self = shift;
516 return $self->stdio_handle;
517 }
518
519 =head2 stdout_handle
520
521 Returns a filehandle used for output to the client. By default,
522 returns whatever was set with C<stdio_handle>, but a subclass
523 could do something interesting here.
524
525 =cut
526
527 sub stdout_handle {
528 my $self = shift;
529 return $self->stdio_handle;
530 }
531
532 =head1 IMPORTANT SUB-CLASS METHODS
533
534 A selection of these methods should be provided by sub-classes of this
535 module.
536
537 =head2 handler
538
539 This method is called after setup, with no parameters. It should
540 print a valid, I<full> HTTP response to the default selected
541 filehandle.
542
543 =cut
544
545 sub handler {
546 my ($self) = @_;
547 if ( ref($self) ne __PACKAGE__ ) {
548 croak "do not call " . ref($self) . "::SUPER->handler";
549 }
550 else {
551 croak "handler called out of context";
552 }
553 }
554
555 =head2 setup(name =E<gt> $value, ...)
556
557 This method is called with a name =E<gt> value list of various things
558 to do with the request. This list is given below.
559
560 The default setup handler simply tries to call methods with the names
561 of keys of this list.
562
563 ITEM/METHOD Set to Example
564 ----------- ------------------ ------------------------
565 method Request Method "GET", "POST", "HEAD"
566 protocol HTTP version "HTTP/1.1"
567 request_uri Complete Request URI "/foobar/baz?foo=bar"
568 path Path part of URI "/foobar/baz"
569 query_string Query String undef, "foo=bar"
570 port Received Port 80, 8080
571 peername Remote name "200.2.4.5", "foo.com"
572 peeraddr Remote address "200.2.4.5", "::1"
573 peerport Remote port 42424
574 localname Local interface "localhost", "myhost.com"
575
576 =cut
577
578 sub setup {
579 my $self = shift;
580 while ( my ( $item, $value ) = splice @_, 0, 2 ) {
581 $self->$item($value) if $self->can($item);
582 }
583 }
584
585 =head2 headers([Header =E<gt> $value, ...])
586
587 Receives HTTP headers and does something useful with them. This is
588 called by the default C<setup()> method.
589
590 You have lots of options when it comes to how you receive headers.
591
592 You can, if you really want, define C<parse_headers()> and parse them
593 raw yourself.
594
595 Secondly, you can intercept them very slightly cooked via the
596 C<setup()> method, above.
597
598 Thirdly, you can leave the C<setup()> header as-is (or calling the
599 superclass C<setup()> for unknown request items). Then you can define
600 C<headers()> in your sub-class and receive them all at once.
601
602 Finally, you can define handlers to receive individual HTTP headers.
603 This can be useful for very simple SOAP servers (to name a
604 crack-fueled standard that defines its own special HTTP headers).
605
606 To do so, you'll want to define the C<header()> method in your subclass.
607 That method will be handed a (key,value) pair of the header name and the value.
608
609
610 =cut
611
612 sub headers {
613 my $self = shift;
614 my $headers = shift;
615
616 my $can_header = $self->can("header");
617 return unless $can_header;
618 while ( my ( $header, $value ) = splice @$headers, 0, 2 ) {
619 $self->header( $header => $value );
620 }
621 }
622
623 =head2 accept_hook
624
625 If defined by a sub-class, this method is called directly after an
626 accept happens. An accept_hook to add SSL support might look like this:
627
628 sub accept_hook {
629 my $self = shift;
630 my $fh = $self->stdio_handle;
631
632 $self->SUPER::accept_hook(@_);
633
634 my $newfh =
635 IO::Socket::SSL->start_SSL( $fh,
636 SSL_server => 1,
637 SSL_use_cert => 1,
638 SSL_cert_file => 'myserver.crt',
639 SSL_key_file => 'myserver.key',
640 )
641 or warn "problem setting up SSL socket: " . IO::Socket::SSL::errstr();
642
643 $self->stdio_handle($newfh) if $newfh;
644 }
645
646 =head2 post_setup_hook
647
648 If defined by a sub-class, this method is called after all setup has
649 finished, before the handler method.
650
651 =head2 print_banner
652
653 This routine prints a banner before the server request-handling loop
654 starts.
655
656 Methods below this point are probably not terribly useful to define
657 yourself in subclasses.
658
659 =cut
660
661 sub print_banner {
662 my $self = shift;
663
664 print( ref($self)
665 . ": You can connect to your server at "
666 . "http://localhost:"
667 . $self->port
668 . "/\n" );
669
670 }
671
672 =head2 parse_request
673
674 Parse the HTTP request line. Returns three values, the request
675 method, request URI and the protocol.
676
677 =cut
678
679 sub parse_request {
680 my $self = shift;
681 my $chunk;
682 while ( sysread( STDIN, my $buff, 1 ) ) {
683 last if $buff eq "\n";
684 $chunk .= $buff;
685 }
686 defined($chunk) or return undef;
687 $_ = $chunk;
688
689 m/^(\w+)\s+(\S+)(?:\s+(\S+))?\r?$/;
690 my $method = $1 || '';
691 my $uri = $2 || '';
692 my $protocol = $3 || '';
693
694 # strip <scheme>://<host:port> out of HTTP/1.1 requests
695 $uri =~ s{^\w+://[^/]+/}{/};
696
697 return ( $method, $uri, $protocol );
698 }
699
700 =head2 parse_headers
701
702 Parses incoming HTTP headers from STDIN, and returns an arrayref of
703 C<(header =E<gt> value)> pairs. See L</headers> for possibilities on
704 how to inspect headers.
705
706 =cut
707
708 sub parse_headers {
709 my $self = shift;
710
711 my @headers;
712
713 my $chunk = '';
714 while ( sysread( STDIN, my $buff, 1 ) ) {
715 if ( $buff eq "\n" ) {
716 $chunk =~ s/[\r\l\n\s]+$//;
717 if ( $chunk =~ /^([^()<>\@,;:\\"\/\[\]?={} \t]+):\s*(.*)/i ) {
718 push @headers, $1 => $2;
719 }
720 last if ( $chunk =~ /^$/ );
721 $chunk = '';
722 }
723 else { $chunk .= $buff }
724 }
725
726 return ( \@headers );
727 }
728
729 =head2 setup_listener
730
731 This routine binds the server to a port and interface.
732
733 =cut
734
735 sub setup_listener {
736 my $self = shift;
737
738 my $tcp = getprotobyname('tcp');
739 my $sockaddr;
740 socket( HTTPDaemon, $self->{'family'}, SOCK_STREAM, $tcp )
741 or croak "socket: $!";
742 setsockopt( HTTPDaemon, SOL_SOCKET, SO_REUSEADDR, pack( "l", 1 ) )
743 or warn "setsockopt: $!";
744
745 if ($self->host) { # Explicit listening address
746 my ($err, @res) = Socket::getaddrinfo($self->host, $self->port, { family => $self->{'family'}, socktype => SOCK_STREAM } );
747 warn "$err!"
748 if ($err);
749 # we're binding only to the first returned address in the requested family.
750 while ($a = shift(@res)) {
751 # Be certain on the address family.
752 # TODO Accept AF_UNSPEC, reject SITE-LOCAL
753 next unless ($self->{'family'} == $a->{'family'});
754
755 # Use the first plausible address.
756 $sockaddr = $a->{'addr'};
757 last;
758 }
759 }
760 else { # Use the wildcard address
761 $sockaddr = ($self->{'family'} == AF_INET6)
762 ? sockaddr_in6($self->port(), Socket::IN6ADDR_ANY)
763 : sockaddr_in($self->port(), INADDR_ANY);
764 }
765
766 bind( HTTPDaemon, $sockaddr)
767 or croak "bind to @{[$self->host||'*']}:@{[$self->port]}: $!";
768 listen( HTTPDaemon, SOMAXCONN ) or croak "listen: $!";
769 }
770
771
772 =head2 after_setup_listener
773
774 This method is called immediately after setup_listener. It's here just
775 for you to override.
776
777 =cut
778
779 sub after_setup_listener {
780 }
781
782 =head2 bad_request
783
784 This method should print a valid HTTP response that says that the
785 request was invalid.
786
787 =cut
788
789 $bad_request_doc = join "", <DATA>;
790
791 sub bad_request {
792 my $self = shift;
793
794 print "HTTP/1.0 400 Bad request\r\n"; # probably OK by now
795 print "Content-Type: text/html\r\nContent-Length: ",
796 length($bad_request_doc), "\r\n\r\n", $bad_request_doc;
797 }
798
799 =head2 valid_http_method($method)
800
801 Given a candidate HTTP method in $method, determine if it is valid.
802 Override if, for example, you'd like to do some WebDAV. The default
803 implementation only accepts C<GET>, C<POST>, C<HEAD>, C<PUT>, C<PATCH>,
804 C<DELETE> and C<OPTIONS>.
805
806 =cut
807
808 sub valid_http_method {
809 my $self = shift;
810 my $method = shift or return 0;
811 return $method =~ /^(?:GET|POST|HEAD|PUT|PATCH|DELETE|OPTIONS)$/;
812 }
813
814 =head1 AUTHOR
815
816 Best Practical Solutions, LLC E<lt>[email protected]<gt>
817
818 =head1 CONTRIBUTORS
819
820 Jesse Vincent, <[email protected]>. Original author.
821
822 Marcus Ramberg <[email protected]> contributed tests, cleanup, etc
823
824 Sam Vilain, <[email protected]> contributed the CGI.pm split-out and
825 header/setup API.
826
827 Example section by almut on perlmonks, suggested by Mark Fuller.
828
829 =head1 BUGS
830
831 There certainly are some. Please report them via rt.cpan.org
832
833 =head1 LICENSE
834
835 This software is Copyright (c) 2004-2015 Best Practical Solutions
836
837 This library is free software; you can redistribute it and/or modify
838 it under the same terms as Perl itself.
839
840 =cut
841
842 1;
843
844 __DATA__
845 <html>
846 <head>
847 <title>Bad Request</title>
848 </head>
849 <body>
850 <h1>Bad Request</h1>
851
852 <p>Your browser sent a request which this web server could not
853 grok.</p>
854 </body>
855 </html>