Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Apache config:
LoadModule perl_module modules/mod_perl.so LoadModule apreq_module modules/mod_apreq2.so <IfModule negotiation_module> MultiviewsMatch Any </IfModule> <IfModule perl_module> PerlSwitches -T <Files *.pl> SetHandler modperl PerlResponseHandler ModPerl::Registry </Files> </IfModule>
use strict; use warnings FATAL => 'all', NONFATAL => 'redefine'; use Apache2::Const -compile => qw(HTTP_NO_CONTENT); use Apache2::Request(); use Apache2::RequestUtil(); use Data::Dumper; my $r = shift; my $req = Apache2::Request->new($r); $r->content_type('text/plain'); $r->status(Apache2::Const::HTTP_NO_CONTENT); my ($s, $m, $h, $D, $M, $Y) = (localtime($r->request_time))[0..5]; my $date = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $Y+1900, $M+1, $D, $h, $m, $s ); { my $filename = '/var/tmp/listen'; open my $fh, '>>', $filename or die "could not open <$filename> fo +r append: $!"; syswrite $fh, $date."\n". $r->as_string."\n\n\n"; syswrite $fh, Dumper($req->body); close $fh; };
16:50 localhost:~> POST -c application/xml -PUSe 'http://localhost/lis +ten2/lol?foo=bar;quux' Please enter content (application/xml) to be POSTed: <lol>xml</lol> POST http://localhost/listen2/lol?foo=bar;quux User-Agent: lwp-request/2.07 Content-Length: 16 Content-Type: application/xml POST http://localhost/listen2/lol?foo=bar;quux --> 204 No Content Connection: close Date: Tue, 18 Apr 2006 14:51:00 GMT Server: Apache/2.2.0 (Unix) mod_apreq2-20051231/2.5.7 mod_perl/2.0.2 P +erl/v5.8.7 Content-Length: 0 Content-Type: text/plain Client-Date: Tue, 18 Apr 2006 14:51:00 GMT Client-Peer: 127.0.0.1:80 Client-Response-Num: 1
2006-04-18 16:51:00 POST /listen2/lol?foo=bar;quux HTTP/1.1 TE: deflate,gzip;q=0.3 Connection: TE, close Host: localhost User-Agent: lwp-request/2.07 Content-Length: 16 Content-Type: application/xml HTTP/1.1 (null)
here.$VAR1 = '<lol>xml</lol> ';
|
|---|