Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

SOAP::Transport::HTTP::Daemon and MAX_CONTENT_SIZE

by menth0l (Monk)
on Aug 19, 2011 at 09:13 UTC ( #921190=perlquestion: print w/replies, xml ) Need Help??
menth0l has asked for the wisdom of the Perl Monks concerning the following question:

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?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://921190]
Approved by mertserger
and cookies bake in the oven...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2018-01-22 04:56 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (231 votes). Check out past polls.