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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.