[Mapbender-commits] r9715 - trunk/mapbender/http_auth/http
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Mar 27 09:24:45 PDT 2017
Author: armin11
Date: 2017-03-27 09:24:45 -0700 (Mon, 27 Mar 2017)
New Revision: 9715
Modified:
trunk/mapbender/http_auth/http/index.php
Log:
Bugfix for owsproxy post handling
Modified: trunk/mapbender/http_auth/http/index.php
===================================================================
--- trunk/mapbender/http_auth/http/index.php 2017-03-27 16:24:30 UTC (rev 9714)
+++ trunk/mapbender/http_auth/http/index.php 2017-03-27 16:24:45 UTC (rev 9715)
@@ -161,6 +161,10 @@
$request = str_replace('?&','?',$request);
//TODO: following is not the standard way because ows has not to handle vsp!!!
$request = delTotalFromQuery("wfs_id",$request);
+ //don't allow get parameters in conjunction with post!
+ if ($postData !== false) {
+ $request = $arrayOnlineresources['wfs_getcapabilities'];
+ }
if (isset($auth)) {
getWfsCapabilities($request, $auth);
} else {
@@ -259,6 +263,7 @@
}
break;
case 'getfeature':
+ //$e = new mb_exception($reqParams['typename']);
$arrayFeatures = array($reqParams['typename']);
$arrayOnlineresources = checkWfsPermission($owsproxyString, $arrayFeatures, $userId);
$query->setOnlineResource($arrayOnlineresources['wfs_getfeature']);
@@ -274,6 +279,10 @@
}
//TODO: following is not the standard way because ows has not to handle vsp!!!
$request = delTotalFromQuery("wfs_id",$request);
+ //don't allow get parameters in conjunction with post!
+ if ($postData !== false) {
+ $request = $arrayOnlineresources['wfs_getfeature'];
+ }
if (isset($auth)) {
getFeature($log_id, $request, $auth);
} else {
@@ -288,6 +297,10 @@
$request = stripslashes($request);
//TODO: following is not the standard way because ows has not to handle vsp!!!
$request = delTotalFromQuery("wfs_id",$request);
+ //don't allow get parameters in conjunction with post!
+ if ($postData !== false) {
+ $request = $arrayOnlineresources['wfs_describefeaturetype'];
+ }
if (isset($auth)) {
describeFeaturetype($request, $auth);
} else {
@@ -304,7 +317,7 @@
doTransaction($request, $HTTP_RAW_POST_DATA);
break;
default:
- echo 'Your are logged in as: <b>' . $requestHeaderArray['username'] . '</b> and requested the layer with id=<b>' . $layerId . '</b> but your request is not a valid OWS request';
+ echo 'Your are logged in as: <b>' . $requestHeaderArray['username'] . '</b> and requested the layer/featuretype with id=<b>' . $layerId . '</b> but your request is not a valid OWS request';
}
//functions for http_auth
@@ -795,7 +808,7 @@
function getWfsCapabilities($request, $auth = false)
{
- global $arrayOnlineresources;
+ global $arrayOnlineresources, $postData;
global $sid, $serviceId, $wfsId;
$t = array(htmlentities(preg_replace('/\?$/','',$arrayOnlineresources["wfs_getcapabilities"])), htmlentities($arrayOnlineresources["wfs_getfeature"]),
htmlentities($arrayOnlineresources["wfs_describefeaturetype"]));
@@ -809,13 +822,30 @@
}
$new = $owsproxyUrl['scheme'] . "://" .$owsproxyUrl['host']. $port . "/registry/wfs/" . $wfsId;# ."?";
- //get actual capabilities from external server
- if (!$auth) {
- $wfsCaps = new connector($request);
+ if ($postData == false) {
+ if (func_num_args() == 4) { //new for HTTP Authentication
+ $auth = func_get_arg(3);
+ $d = new connector($request, $auth);
+ } else {
+ $d = new connector($request);
+ }
+ $wfsCaps = $d->file;
} else {
- $wfsCaps = new connector($request, $auth);
+ //$e = new mb_exception("owsproxy/index.php: postData will be send: ".$postData);
+ $postInterfaceObject = new connector();
+ $postInterfaceObject->set('httpType','POST');
+ $postInterfaceObject->set('curlSendCustomHeaders',true);
+ $postInterfaceObject->set('httpPostData', $postData);
+ $postInterfaceObject->set('httpContentType','text/xml');
+ if (func_num_args() == 4) { //new for HTTP Authentication
+ $auth = func_get_arg(3);
+ $postInterfaceObject->load($request, $auth);
+ } else {
+ $postInterfaceObject->load($request);
+ }
+ $wfsCaps = $postInterfaceObject->file;
}
- $r = str_replace($t, $new, $wfsCaps->file);
+ $r = str_replace($t, $new, $wfsCaps);
//delete trailing amp; 's
$r = str_replace('amp;', '', $r);
header("Content-Type: application/xml");
@@ -1001,6 +1031,7 @@
}
$content = $d->file;
} else {
+ $e = new mb_exception("owsproxy/index.php: postData will be send ");
$postInterfaceObject = new connector();
$postInterfaceObject->set('httpType','POST');
$postInterfaceObject->set('curlSendCustomHeaders',true);
More information about the Mapbender_commits
mailing list