--- HTTP.pm.dist Sat Dec 11 14:27:34 2004 +++ HTTP.pm Sat Dec 11 14:28:05 2004 @@ -11,10 +11,27 @@ package SOAP::Transport::HTTP; use strict; +#use warnings; use vars qw($VERSION); $VERSION = sprintf("%d.%s", map {s/_//g; $_} q$Name: $ =~ /-(\d+)_([\d_]+)/); use SOAP::Lite; +use Apache2; +use mod_perl; +#use APR::Table; + +use constant MP2 => $mod_perl::VERSION >= 1.99; + +BEGIN { + if (MP2) { + require Apache::Const; + Apache::Const->import(-compile => qw(OK DECLINED)); + } + else { + require Apache::Constants; + Apache::Constants->import(qw(OK DECLINED)); + } +} # ====================================================================== @@ -441,7 +458,11 @@ sub DESTROY { SOAP::Trace::objects('()') } -sub new { require Apache; require Apache::Constants; +sub new { + #require Apache; require Apache::Constants; + require Apache2; +# require Apache::RequestRec; + require Apache::Const; my $self = shift; unless (ref $self) { @@ -453,13 +474,19 @@ } sub handler { + + use constant MP2 => $mod_perl::VERSION >= 1.99; + + require Apache::RequestIO; + require Apache::RequestRec; + my $self = shift->new; my $r = shift || Apache->request; $self->request(HTTP::Request->new( $r->method => $r->uri, HTTP::Headers->new($r->headers_in), - do { my $buf; $r->read($buf, $r->header_in('Content-length')); $buf; } + do { my $buf; $r->read($buf, $r->headers_in->{'Content-length'}); $buf; } )); $self->SUPER::handle; @@ -470,15 +497,17 @@ # will emulate normal response, but with custom status code # which could also be 500. $r->status($self->response->code); - $self->response->headers->scan(sub { $r->header_out(@_) }); - $r->send_http_header(join '; ', $self->response->content_type); + $self->response->headers->scan(sub { $r->headers_out->{@_} }); + #$r->send_http_header(join '; ', $self->response->content_type); + $r->content_type(join '; ', $self->response->content_type); $r->print($self->response->content); - &Apache::Constants::OK; + return MP2 ? Apache::OK : &Apache::Constants::OK; } sub configure { my $self = shift->new; my $config = shift->dir_config; + require APR::Table; foreach (%$config) { $config->{$_} =~ /=>/ ? $self->$_({split /\s*(?:=>|,)\s*/, $config->{$_}}) @@ -591,7 +620,7 @@ =item mod_soap server (.htaccess, directory-based access) SetHandler perl-script - PerlHandler Apache::SOAP + PerlResponseHandler Apache::SOAP PerlSetVar dispatch_to "/Your/Path/To/Deployed/Modules, Module::Name, Module::method" PerlSetVar options "compress_threshold => 10000" @@ -808,7 +837,7 @@ SetHandler perl-script - PerlHandler SOAP::Apache + PerlResponseHandler SOAP::Apache Apache.pm: @@ -831,7 +860,7 @@ Alias /mod_perl/ "/Apache/mod_perl/" SetHandler perl-script - PerlHandler Apache::Registry + PerlResponseHandler Apache::Registry PerlSendHeader On Options +ExecCGI