Item13800: Can't locate object method "LastCall" via package "HTTP::Headers"

pencil
Priority: Enhancement
Current State: Closed
Released In: n/a
Target Release:
Applies To: Extension
Component: WebDAVContrib
Branches: master
Reported By: FlorianSchlichting
Waiting For:
Last Change By: FlorianSchlichting
in lib/FCGI/FoswikiWebDAV.pm, the my $r in line 100 (a HTTP::Request) shadows the earlier $r from line 54 (a FCGI::Request). The LastCall() method in line 140 is only defined for FCGI::Request, though, leading to logged error messages such as:

[Tue Oct 06 12:49:50 2015] [warn] [client 130.133.x.x] mod_fcgid: stderr: DIE Can't locate object method "LastCall" via package "HTTP::Headers" at /usr/share/perl5/HTTP/Message.pm line 649.
[Tue Oct 06 12:49:50 2015] [warn] [client 130.133.x.x] mod_fcgid: stderr: Can't locate object method "LastCall" via package "HTTP::Headers" at /usr/share/perl5/HTTP/Message.pm line 649.
[Tue Oct 06 12:49:50 2015] [warn] [client 130.133.x.x] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Tue Oct 06 12:49:50 2015] [error] [client 130.133.x.x] Premature end of script headers: webdav.fcgi

I suggest to disentangle this as follows:

--- a/lib/FCGI/FoswikiWebDAV.pm
+++ b/lib/FCGI/FoswikiWebDAV.pm
@@ -97,27 +97,27 @@ sub run {
         $SIG{__DIE__}  = sub { print STDERR "DIE ",  @_ };
 
         # Pull in FCGI environment
-        my $r = new HTTP::Request( $ENV{REQUEST_METHOD}, $ENV{REQUEST_URI} );
+        my $request = new HTTP::Request( $ENV{REQUEST_METHOD}, $ENV{REQUEST_URI} );
 
         foreach my $header ( keys %ENV ) {
             next unless $header =~ /^(?:HTTP|CONTENT|COOKIE)/i;
             ( my $field = $header ) =~ s/^HTTPS?_//;
-            $r->header( $field => $ENV{$header} );
+            $request->header( $field => $ENV{$header} );
         }
 
         # Pull in content
-        if ( my $bytes = $r->header('Content-Length') ) {
+        if ( my $bytes = $request->header('Content-Length') ) {
             my $content;
             my $read = read( STDIN, $content, $bytes );
-            $r->content($content);
+            $request->content($content);
         }
 
         # Compose response
         my $response = new HTTP::Response();
         $response->protocol('HTTP/1.1');
         my $status =
-          $this->handleRequest( $r, $response,
-            new HTTP::BasicAuth( $r, $this->{realm} ) );
+          $this->handleRequest( $request, $response,
+            new HTTP::BasicAuth( $request, $this->{realm} ) );
 
         # FCGI isn't happy with just the status line; it needs the
         # header field as well.

-- FlorianSchlichting - 06 Oct 2015

Crawford, any objections before creating a new release?

-- MichaelDaum - 08 Mar 2016

None.

-- Main.CrawfordCurrie - 11 Apr 2016 - 19:54
 
Topic revision: r4 - 08 Nov 2016, FlorianSchlichting
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy