Hello,

I'm using LWP::UserAgent v 1.69, which I know is quite old but I have to use
it for now. I have a problem which has just arisen and I'd appreciate some
advice from someone who knows the internals of LWP::Protocol::http.

A week or so ago, my HTTP PUTs stopped working properly. I suspect something
may have changed on the server (which is Netscape-Enterprise/3.5.1) but I
haven't been able to find out what it is yet. 

What happens is, the file from my PUT is created, but the connection times
out, and there's nothing in the http error log.

An LWP debug log shows (I've changed file and host to test strings)

LWP::UserAgent::request: ()
LWP::UserAgent::simple_request: PUT /test
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::Protocol::http::request: PUT /test HTTP/1.0
Host: testhost
User-Agent: libwww-perl/5.47
Content-Length: 103
Content-Type: text/plain
 
LWP::Protocol::http::request: PUT /test HTTP/1.0
Host: testhost
User-Agent: libwww-perl/5.47
Content-Length: 103
Content-Type: text/plain
 
LWP::Protocol::http::request: reading response
LWP::Protocol::http::request: HTTP/1.1 204 No response
Server: Netscape-Enterprise/3.5.1
Date: Thu, 17 Feb 2005 11:13:11 GMT
 
LWP::Protocol::http::request: HTTP/1.1 204 No response
LWP::UserAgent::request: Simple result: Internal Server Error 500 read
timeout

I debugged the connection, and it appears that it gets to
LWP::Protocol:http::request

233:        $response->request($request);
  DB<6> x $response
0  HTTP::Response=HASH(0xab3934)
   '_content' => ''
   '_headers' => HTTP::Headers=HASH(0xab391c)
      'date' => 'Thu, 17 Feb 2005 11:26:43 GMT'
      'server' => 'Netscape-Enterprise/3.5.1'
   '_msg' => 'No response'
   '_protocol' => 'HTTP/1.1'
   '_rc' => 204

Where the file is created and the response has been received. It then does 

   my $usebuf = length($buf) > 0;
    $response = $self->collect($arg, $response, sub {
        if ($usebuf) {
            $usebuf = 0;
            return \$buf;
        }
        die "read timeout" if $timeout && !$sel->can_read($timeout);
        my $n = $socket->sysread($buf, $size);
        die $! unless defined($n);
        #LWP::Debug::conns($buf);
        return \$buf;
        } );

The $self->collect call appears to then timeout with the UA timeout. 

I'm not sure whether it's trying to read more data because of return code No
Response. I had thought No Response was a valid return code for a PUT. I've
reached the limits of my knowledge here so if anyone has any suggestions
they'd be appreciated. It's probably something simple.

thanks
Dave

Reply via email to