LoadModule perl_module modules/mod_perl.so
LoadModule apreq_module modules/mod_apreq2.so
MultiviewsMatch Any
PerlSwitches -T
SetHandler modperl
PerlResponseHandler ModPerl::Registry
####
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> for 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/listen2/lol?foo=bar;quux'
Please enter content (application/xml) to be POSTed:
xml
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 Perl/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)
####
$VAR1 = 'xml
';