Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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?

Comment on SOAP::Transport::HTTP::Daemon and MAX_CONTENT_SIZE
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://921190]
Approved by mertserger
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2015-07-06 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (75 votes), past polls