Loading ...
Sorry, an error occurred while loading the content.

Re: SOAP::Lite port for mod_perl 2.0

Expand Messages
  • Andre Merzky
    Wow! Thanks for the patch!! Andre. ... -- +-----------------------------------------------------------------+ ...
    Message 1 of 4 , Jun 15, 2005
    • 0 Attachment
      Wow! Thanks for the patch!!

      Andre.

      Quoting [kyriacos71] (Jun 15 2005):
      > Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
      > Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
      > To: soaplite@yahoogroups.com
      > From: "kyriacos71" <kyriacosk@...>
      > Mailing-List: list soaplite@yahoogroups.com; contact soaplite-owner@yahoogroups.com
      > Date: Wed, 15 Jun 2005 06:52:50 -0000
      > Subject: [soaplite] Re: SOAP::Lite port for mod_perl 2.0
      >
      > I have manage to create a patch for SOAP::Transport::HTTP that is the
      > only module need patching in order to run on mod_perl 2.x. This
      > apllies to latest distribution of SOAP::Lite (SOAP-Lite-0.65_6) and
      > accrding to my checks after applying it is working on all version of
      > mod_perl (1.xx, 1.99, 2.xx)
      >
      > Here is the path:
      > ----------------begin of patch -----------------------
      > --- /usr/src/SOAP-Lite-0.65_6_org/lib/SOAP/Transport/HTTP.pm 2005-
      > 03-30 11:58:34.000000000 +0300
      > +++ /usr/src/SOAP-Lite-0.65_6/lib/SOAP/Transport/HTTP.pm 2005-
      > 06-15 01:19:22.819470272 +0300
      > @@ -505,23 +505,34 @@
      > $self = $class->SUPER::new(@_);
      > SOAP::Trace::objects('()');
      > }
      > - die "Could not find or load mod_perl"
      > - unless (eval "require mod_perl");
      > - die "Could not detect your version of mod_perl"
      > - if (!defined($mod_perl::VERSION));
      > - if ($mod_perl::VERSION < 1.99) {
      > - require Apache;
      > - require Apache::Constants;
      > - Apache::Constants->import('OK');
      > - $self->{'MOD_PERL_VERSION'} = 1;
      > - } elsif ($mod_perl::VERSION < 3) {
      > - require Apache::RequestRec;
      > - require Apache::RequestIO;
      > - require Apache::Const;
      > - Apache::Const->import(-compile => 'OK');
      > +
      > + if( defined $ENV{MOD_PERL_API_VERSION} && $ENV
      > {MOD_PERL_API_VERSION} >= 2) { # mod_perl 2.0
      > + require Apache2::RequestRec;
      > + require Apache2::RequestIO;
      > + require Apache2::Const;
      > + Apache2::Const->import(-compile => 'OK');
      > $self->{'MOD_PERL_VERSION'} = 2;
      > - } else {
      > - die "Unsupported version of mod_perl";
      > + $self->{OK} = &Apache2::Const::OK;
      > + } else { # mod_perl 1.xx
      > + die "Could not find or load mod_perl"
      > + unless (eval "require mod_perl");
      > + die "Could not detect your version of mod_perl"
      > + if (!defined($mod_perl::VERSION));
      > +
      > + if ($mod_perl::VERSION < 1.99) {
      > + require Apache;
      > + require Apache::Constants;
      > + Apache::Constants->import('OK');
      > + $self->{'MOD_PERL_VERSION'} = 1;
      > + $self->{OK} = &Apache::Constants::OK;
      > + } else {
      > + require Apache::RequestRec;
      > + require Apache::RequestIO;
      > + require Apache::Const;
      > + Apache::Const->import(-compile => 'OK');
      > + $self->{'MOD_PERL_VERSION'} = 1.99;
      > + $self->{OK} = &Apache::OK;
      > + }
      > }
      > return $self;
      > }
      > @@ -529,12 +540,20 @@
      > sub handler {
      > my $self = shift->new;
      > my $r = shift;
      > - $r = Apache->request if (!$r && $self->{'MOD_PERL_VERSION'} == 1);
      > +
      > + if(!$r) {
      > + if( $self->{'MOD_PERL_VERSION'} < 2 ) { $r = Apache->request
      > () }
      > + else { $r = Apache2::RequestUtil->request() }
      > + }
      > +
      > + my $cont_len;
      > + if( $self->{'MOD_PERL_VERSION'} == 1 ) { $cont_len = $r->header_in
      > ('Content-length') }
      > + else { $cont_len = $r-
      > >headers_in->get('Content-length') }
      >
      > $self->request(HTTP::Request->new(
      > $r->method() => $r->uri,
      > HTTP::Headers->new($r->headers_in),
      > - do { my ($c,$buf); while ($r->read($buf,$r->header_in('Content-
      > length'))) { $c.=$buf; } $c; }
      > + do { my ($c,$buf); while ($r->read($buf, $cont_len)) {
      > $c.=$buf; } $c; }
      > ));
      > $self->SUPER::handle;
      >
      > @@ -545,10 +564,15 @@
      > # 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);
      > + if ( $self->{'MOD_PERL_VERSION'} > 1 ) {
      > + $self->response->headers->scan(sub { $r->headers_out->set
      > (@_) });
      > + $r->content_type(join '; ', $self->response->content_type);
      > + } else {
      > + $self->response->headers->scan(sub { $r->header_out(@_) });
      > + $r->send_http_header(join '; ', $self->response->content_type);
      > + }
      > $r->print($self->response->content);
      > - return $self->{'MOD_PERL_VERSION'} == 2 ? &Apache::OK :
      > &Apache::Constants::OK;
      > + return $self->{OK};
      > }
      >
      > sub configure {
      > -------- end of patch -----------------------------------
      >
      > Kyriacos C. Kyriacou
      >
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >



      --
      +-----------------------------------------------------------------+
      | Andre Merzky | phon: +31 - 20 - 598 - 7759 |
      | Vrije Universiteit Amsterdam (VU) | fax : +31 - 20 - 598 - 7653 |
      | Dept. of Computer Science | mail: merzky@... |
      | De Boelelaan 1083a | www: http://www.merzky.net |
      | 1081 HV Amsterdam, Netherlands | |
      +-----------------------------------------------------------------+
    Your message has been successfully submitted and would be delivered to recipients shortly.