blob: 7d5273510653741c757a7c61a7444d89ed670459 [file] [log] [blame]
#!/usr/bin/perl
#
# for this to work, perl module needs to be installed
# in ubuntu run
#
# sudo apt-get install libapache2-mod-perl2
# sudo apache2ctl restart
#
package ReceiveCommandReturnEmpty;
use strict;
use Apache2::RequestIO ();
use Apache2::RequestUtil ();
use Apache2::RequestRec ();
use Apache2::Log ();
use Apache2::Const -compile => qw(OK DECLINED :log);
#use Apache2::Const -compile => qw(OK);
sub handler {
my $r = shift;
# handle POST requests
if ( $r->method() eq "POST") {
# create a post data buffer
my $PostBuffer = '';
$r->log->notice("RootPATest.empty: Post Command Received. Data:");
# loop over each line of data
while($r->read($PostBuffer, 1024)) {
$r->log->notice("'$PostBuffer'");
}
} else {
if ( $r->method() eq "PUT") {
# handle PUT requests
# create a put data buffer
my $PutBuffer = '';
$r->log->notice("RootPATest.empty: Put Command Received. Data:");
# loop over each line of data
while($r->read($PutBuffer, 1024)) {
$r->log->notice("'$PutBuffer'");
}
} else {
$r->log->notice("RootPATest.empty: HTTP command was not POST or PUT");
if ( $r->method() eq "DELETE") {
$r->log->notice("RootPATest.empty: but DELETE, how did we get here?");
}else{
$r->log->notice("RootPATest.empty: but $r->method()");
}
}
}
return Apache2::Const::OK;
}
1;