[mapserver-users] Post body is short

Hawk AA hawk at aamdal.com
Sun Dec 4 16:36:04 EST 2011


Hi there,

 

We are running a service where the access to mapfiles needs to be password
protected. I’m using PHP Session for that, and until recently I’ve used a
wrapper which looked like this:

 

session_start();

$oParams = new HawkSoftware\URL\REQUESTParameters();

try {

            $oParams->RemoveKey("MAP", false);

            

      } catch (Exception $e) {

            

      }

      $oParams->Items['map'] = $_SESSION['MAPFILE'];

 

$strURL = "C:/ms4w/Apache/cgi-bin-hidden/mapserv.exe QUERY_STRING=\"" .
$oParams->GetUTF8DecodedString() . "\"";

 

if ($oParams->Items['encode'] == 'true') {

      echo utf8_encode(HawkSoftware\Execution\Util::GetOutput($strURL));

} else {

      echo HawkSoftware\Execution\Util::GetOutput($strURL);

}

 

The GetOutput-function uses passthru(). The only problem with that one is
the command line restriction (of somewhat 8k characters) in windows, which
sometimes becomes a limitation for requesting over 70 ID’s on a WFS request
(those Filter strings become very long!!). Also, I don’t think it’s the most
efficient way to fetch data from mapserv.exe .

 

So I saw the http://mapserver.org/ogc/mapscript.html and made a script like
this:

 

$oMap = new \mapObj($_SESSION['MAPFILE']);

      $oRequest = new OWSRequestObj();

      $oRequest->loadparams();

      ms_ioinstallstdouttobuffer();

      $oMap->owsdispatch($oRequest);

      

      $strContType = ms_iostripstdoutbuffercontenttype();

      if ($strContType == 'image/png') {

            header('Content-type: image/png');

      }

      

      if($_REQUEST['encode']) {

            echo utf8_encode(ms_iogetstdoutbufferstring());

      } else {

            ms_iogetStdoutBufferBytes();

      }

      ms_ioresethandlers();

 

This one works great on GET requests. However, it does not work on POST
requests, it will print “Post body is short” (I really need the post
requests, as GET does not carry enough data). This is a known issue, but I
can’t say I know what to do about it. Some say it’s problem with the fastcgi
module, and it will run fine on cgi. But how do I get mapscript to run on
CGI? Or is this the wrong approach?

 

I am running ms4w on Windows Server 2008 .

 

Best regards,

Håkon

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20111204/56272241/attachment-0001.html


More information about the mapserver-users mailing list