You are here: Foswiki>Tasks Web>Item13228 (05 Jul 2015, GeorgeClark)Edit Attach

Item13228: jsonrpc fails with no method if Apache2::Request is installed.

pencil
Priority: Urgent
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Extension
Component: JsonRpcContrib, ModPerlEngineContrib
Branches: master
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
Foswiki appeared to be working fine under ModPerl, until the recommended Apache2::Request module was installed.

Once enabled, jsonrpc requests all fail with "Invalid JSON-RPC request - no method"

-- GeorgeClark - 24 Jan 2015

The underlying problem is that Apache2::Request does not make data available using POSTDATA. The JSON POST requests upload the application/json string as an "anonymous" upload. The proper way to handle this is to open a stream handle against the Apache2::Request object, otherwise the data is just not available.

Digging down through the Engine::Apache code, it does detect the json data as an upload, but because there is no filename key associated with the data, the Foswiki upload mechanism cannot open a stream against the file. If down in the Engine::Apache::prepareUploads() method I detect the case of an upload without any filename keys, and issue a direct read against the request, it returns the json data without any problem:
+        #else {
+        #            $this->{query}->read(my $data,  $contentLength );
+        #            print STDERR Data::Dumper::Dumper( \$data );
+        #            
+        #}

However by the time JsonRpcContrib::Request gets the request object, it doesn't have a read() method and there does not appear to be any way to get the posted data.

-- GeorgeClark - 24 Jan 2015

Fixed, but needs review by someone more familiar with mod_perl

-- GeorgeClark - 25 Jan 2015
 
Topic revision: r8 - 05 Jul 2015, GeorgeClark
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