Subject: | SOAP::Transport::HTTP::CGI returns HTTP response headers terminated by "\n" instead of "\r\n" |
Distribution: SOAP-Lite-0.60a (does not appear to be resolved in 0.65-3)
Perl version: 5.6.1
OS: Linux 2.6.1-5 #1 SMP Mon Jun 7 12:47:27 PDT 2004 i686 unknown
Using the CGI HTTP transport, the http headers returned with the soap
response are terminated with a "\n" character. This seems to be acceptable with clients created with the SOAP-Lite. However, returning these headers to a client created with MS .Net, the following is returned:
System.Net.WebException: The underlying connection was closed: The
server committed an HTTP protocol violation.
at
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
etc...
Apparently, the violation is caused by the MS library expecting to see http headers terminated by "\r\n" (which I believe is what the HTTP spec calls for...)
The offending code in the HTTP.pm module... (lines 375 - 379)
my $code = $self->response->code;
binmode(STDOUT); print STDOUT
"$status $code ", HTTP::Status::status_message($code),
"\015\012", $self->response->headers_as_string,
"\015\012", $self->response->content;
could be modified as follows to fix the problem:
my $code = $self->response->code;
binmode(STDOUT); print STDOUT
"$status $code ", HTTP::Status::status_message($code),
"\015\012", $self->response->headers_as_string("\015\012"),
"\015\012", $self->response->content;
I tried to find a way around making this change to the library by modifying the returned headers in my server code, but, as of yet, have not been able to find a way to get access to this data.
Thanks for your help,
Steve