Hi,
I want to limit SOAP requests size while using SOAP::Transport::HTTP::Daemon but i've found that it totally ignores SOAP::Constants::MAX_CONTENT_SIZE setting. I created workaround by developing my own daemon class which overrides handle() method:
package SOAP::Transport::HTTP::Daemon2;
use SOAP::Transport::HTTP;
use HTTP::Response;
use Data::Dumper;
@ISA = qw(SOAP::Transport::HTTP::Daemon);
sub handle
{
my $self = shift->new;
while ( my $c = $self->accept )
{
while ( my $r = $c->get_request )
{
$self->request($r);
SOAP::Transport::HTTP::Server::handle($self);
my $length = $r->headers->header('Content-Length') || 0;
if (!$length) {
$c->send_response(HTTP::Response->new(411))
}
elsif ($length > $SOAP::Constants::MAX_CONTENT_SIZE) {
$c->send_response(HTTP::Response->new(413))
}
else {
$c->send_response($self->response);
}
}
$c->can('shutdown')
? $c->shutdown(2)
: $c->close();
$c->close;
}
}
Yet, I'm not sure if this is the proper way. Is there an out-of-the-box solution? As far as i am concerned the only class that uses MAX_CONTENT_SIZE is CGI server class... And if sub-classing is the only choice then did i missed something in my code?