Skip Menu |

This queue is for tickets about the SOAP-Lite CPAN distribution.

Report information
The Basics
Id: 56716
Status: rejected
Priority: 0/
Queue: SOAP-Lite

People
Owner: Nobody in particular
Requestors: vitalif [...] mail.ru
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.711
Fixed in: (no value)



Subject: Incorrect request body reading under mod_perl
SOAP::Transport::HTTP reads HTTP request body in an incorrect way at least under mod_perl2. Reading from STDIN is incorrect. Reading with $r->read() (Apache2::RequestIO) is correct. A simple patch which uses CGI->read_from_client() as a universal method of reading request data is attached.
Subject: SOAP-Transport-HTTP.pm-for_mod_perl.diff
--- HTTP.pm 2010-03-18 21:29:10.000000000 +0300 +++ HTTP.pm1 2010-04-17 01:52:42.000000000 +0400 @@ -500,6 +500,13 @@ sub product_tokens { # ====================================================================== +package SOAP::Transport::HTTP::CGIhack; +use CGI; +use vars qw(@ISA); +@ISA = qw(CGI); + +sub init {} + package SOAP::Transport::HTTP::CGI; use vars qw(@ISA); @@ -533,13 +540,15 @@ sub handle { my $chunked = (defined $ENV{'HTTP_TRANSFER_ENCODING'} && $ENV{'HTTP_TRANSFER_ENCODING'} =~ /^chunked.*$/) || 0; + my $r = SOAP::Transport::HTTP::CGIhack->new; my $content = q{}; if ($chunked) { my $buffer; - binmode(STDIN); - while ( read( STDIN, my $buffer, 1024 ) ) { +# binmode(STDIN); +# while ( read( STDIN, my $buffer, 1024 ) ) { + while ( $r->read_from_client( \ (my $buffer), 1024 ) ) { $content .= $buffer; } $length = length($content); @@ -560,8 +569,9 @@ sub handle { #my $content = q{}; if ( !$chunked ) { my $buffer; - binmode(STDIN); - while ( sysread( STDIN, $buffer, $length ) ) { +# binmode(STDIN); + while ( $r->read_from_client( \$buffer, $length ) ) { +# while ( sysread( STDIN, $buffer, $length ) ) { $content .= $buffer; last if ( length($content) >= $length ); }
Hi, this is a wonderful example of mod_perl not being CGI. There's SOAP::Transport::HTTP::Apache for mod_perl support - you can just pass Apache::RequestRec->request to it's handler method when used in a script instead of a handler. Martin
Show quoted text
> There's SOAP::Transport::HTTP::Apache for mod_perl support - you can > just pass Apache::RequestRec->request to it's handler method when used > in a script instead of a handler.
SOAP::Transport::HTTP::Apache is useful only for Apache 1 and mod_perl 1.x. It has Apache and Apache::Constants dependencies. I use Apache 2 and mod_perl 2.x. There is no Apache or Apache::Constants modules. CGI.pm works in mod_perl 1/2 environment. I think SOAP::Transport::HTTP::CGI can also work. Moreover, I think one of SOAP::Transport::HTTP or XMLRPC::Transport::HTTP must select appropriate package in runtime by itself.
Why you rejected this bug again? Have you read my last comment?
Subject: Re: [rt.cpan.org #56716] Incorrect request body reading under mod_perl
Date: Wed, 21 Apr 2010 19:40:55 +0200
To: bug-SOAP-Lite [...] rt.cpan.org
From: Martin Kutter <martin.kutter [...] fen-net.de>
Hi, Am Mittwoch, den 21.04.2010, 07:58 -0400 schrieb http://simply-a-man.livejournal.com/ via RT: Show quoted text
> Queue: SOAP-Lite > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=56716 > > > Why you rejected this bug again? > Have you read my last comment? >
Sending a reply to a rejected bug reopens it. This is why I rejected it again. Show quoted text
> > There's SOAP::Transport::HTTP::Apache for mod_perl support - you can > > just pass Apache::RequestRec->request to it's handler method when used > > in a script instead of a handler.
> > SOAP::Transport::HTTP::Apache is useful only for Apache 1 and mod_perl > 1.x. It has Apache and Apache::Constants dependencies.
This is wrong. Show quoted text
> I use Apache 2 and mod_perl 2.x. There is no Apache or > Apache::Constants modules.
SOAP::Transport::HTTP::Apache loads the appropriate modules under mod_perl. Show quoted text
> CGI.pm works in mod_perl 1/2 environment. I think > SOAP::Transport::HTTP::CGI can also work.
SOAP::Transport::HTTP::Apache works in mod_perl 1/2 environments, too Show quoted text
> Moreover, I think one of SOAP::Transport::HTTP or > XMLRPC::Transport::HTTP must select appropriate package in runtime by > itself.
This is wrong. The programmer has to select the appropriate transport backend for all server implementations. It looks your bug is a usage error. Please direct usage questions to the yahoo forum, not to the CPAN RT bug tracker. Martin
Oops. Sorry. There's another SOAP::Transport::HTTP::Apache in SOAP package (not in SOAP::Lite), and it does not support Apache2. I was looking at it, not at your module :) http://search.cpan.org/~kbrown/SOAP-0.28/lib/SOAP/Transport/HTTP/Apache.pm Thank you for your help!