Hi Felix,
actually, the HTTP spec says a server should return a 400 Bad Request
error on requests without Content-length header.
Thus, the correct patch is likely to look like this:
Index: lib/SOAP/Transport/HTTP.pm
===================================================================
RCS file: /cvsroot/soaplite/soaplite-dist/lib/SOAP/Transport/HTTP.pm,v
retrieving revision 1.28
diff -u -r1.28 HTTP.pm
--- lib/SOAP/Transport/HTTP.pm 1 Dec 2007 12:32:19 -0000 1.28
+++ lib/SOAP/Transport/HTTP.pm 3 Dec 2007 18:24:06 -0000
@@ -683,16 +683,23 @@
}
# End patch from JT Justman
+ my $content = "";
+ if ($cont_len > 0) {
+ my $buf;
+ # attempt to slurp in the content at once...
+ $content .= $buf while ($r->read($buf,$cont_len) > 0);
+ }
+ else {
+ # throw appropriate error for mod_perl 2
+ return Apache2::Const::HTTP_BAD_REQUEST()
+ if ($self->{'MOD_PERL_VERSION'} >= 2);
+ return Apache::Constant::BAD_REQUEST();
+ }
+
$self->request(HTTP::Request->new(
$r->method() => $r->uri,
HTTP::Headers->new($r->headers_in),
- do {
- my ($c,$buf);
- while ($r->read($buf,$cont_len)) {
- $c .= $buf;
- }
- $c;
- }
+ $content
));
$self->SUPER::handle;
I'll apply it to CVS.
Thanks for reporting,
Martin
Am Montag, den 03.12.2007, 11:46 +0100 schrieb Felix J. Ogris:
> Hi,
>
> SOAP::Transport::HTTP::Apache::handler() will complain with s.th. like "The
> LENGTH argument can't be negative at
> /usr/local/lib/perl5/site_perl/5.8.8/SOAP/Transport/HTTP.pm line 692" if the
> request contains no Content-Length header (eg. GET). So you get a server
> error instead of a "405 - method not allowed" response. My patch for the
> latest CVS version fixes that.
>
> Felix
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by: The Future of Linux Business White Paper
> from Novell. From the desktop to the data center, Linux is going
> mainstream. Let it simplify your IT future.
> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
> _______________________________________________ Soaplite-devel mailing list Soa...@li... https://lists.sourceforge.net/lists/listinfo/soaplite-devel
|