Hue-Bond has asked for the wisdom of the Perl Monks concerning the following question:

(I honestly believe this is a Perl related question. Please be kind on me if I'm wrong O:^)).

This simple server:

use warnings; use strict; use SOAP::Transport::HTTP; SOAP::Transport::HTTP::CGI ->dispatch_to ('/home/hue/lang/perl/modules', 'HelloWorld') ->handle;

does not return a proper HTTP status line (ie, the "HTTP/1.1 200 OK" one). Instead, it returns "Status: 200 OK", which is making the client I'm using fail. Upon investigation, I found a conditional on line 373 of SOAP/Transport/HTTP.pm, the code decides to send "Status:" because I'm not running IIS, due to what seems to be a bug in IIS concerning non-parsed-headers.

I see no way of making SOAP::Lite send a standard status line as specified in RFC 2616 (section 6.1) so I must assume I don't know something and that "Status:" line is in some way "right". So, what am I missing? Is my client buggy for not accepting "Status:"?

--
David Serrano

Replies are listed 'Best First'.
Re: SOAP::Lite and HTTP status line
by shmem (Chancellor) on Sep 18, 2006 at 14:43 UTC
    You have two choices - hack the module and send a patch, or file a feature request, i.e. bother the author of the module to do it. But IMHO there should be a switch for nph - as CGI has it.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      IMHO there should be a switch for nph

      I tried to modify SOAP/Transport/HTTP.pm. Since I hardly have any experience at patching others' code, I thought it would be a good idea to ask for advice here instead of submitting a possibly wrong bug report/fix. Well, this is the original code of S::T::H::CGI::handle:

      And I applied these changes:

      # imitate nph- cgi for IIS (pointed by Murray Nesbitt) - my $status = defined($ENV{'SERVER_SOFTWARE'}) && $ENV{'SERVER_SOFTW +ARE'}=~/IIS/ - ? $ENV{SERVER_PROTOCOL} || 'HTTP/1.0' : 'Status:'; + my $status; + if ($self->{'nph'}) { + $status = $ENV{SERVER_PROTOCOL} || 'HTTP/1.0'; + } else { + $status = defined($ENV{'SERVER_SOFTWARE'}) && $ENV{'SERVER_SOFTWA +RE'}=~/IIS/ + ? $ENV{SERVER_PROTOCOL} || 'HTTP/1.0' : 'Status:'; + } my $code = $self->response->code;

      Plus, I added a nph function:

      sub nph { my $self = shift; $self->{'nph'} = 1; return $self; }

      So now, I just add a call to nph and I get a proper HTTP response:

      SOAP::Transport::HTTP::CGI ->dispatch_to ('/home/hue/lang/perl/modules', 'HelloWorld') ->nph ->handle;

      Do you monks thing it's ok to submit this? Thank you for your valuable input.

      --
      David Serrano

        I think that's perfectly ok for submission.

        --shmem

        _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                      /\_¯/(q    /
        ----------------------------  \__(m.====·.(_("always off the crowd"))."·
        ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: SOAP::Lite and HTTP status line
by greatshots (Pilgrim) on Sep 18, 2006 at 11:12 UTC
    Hue-Bond,

    CGI scripts are not running under Microsoft Internet Information Server (IIS).CGI scripts may not work under IIS unless scripts are .pl, not .cgi.
    information is taken from SOAP::Transport::HTTP

      CGI scripts are not running under Microsoft Internet Information Server (IIS).

      Yes they do. CGI (as can be seen in the very first line of this manpage) means Common Gateway Interface, and scripts that implement that technology are CGI scripts, be they named *.pl, *.cgi, *.sh or *.blunze.

      But this isn't the point of the OP...

      --shmem

      _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                    /\_¯/(q    /
      ----------------------------  \__(m.====·.(_("always off the crowd"))."·
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}