[Mapbender-commits] r9717 - trunk/mapbender/owsproxy/http

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Mar 27 09:25:07 PDT 2017


Author: armin11
Date: 2017-03-27 09:25:07 -0700 (Mon, 27 Mar 2017)
New Revision: 9717

Modified:
   trunk/mapbender/owsproxy/http/index.php
Log:
Bugfix for owsproxy post handling

Modified: trunk/mapbender/owsproxy/http/index.php
===================================================================
--- trunk/mapbender/owsproxy/http/index.php	2017-03-27 16:24:57 UTC (rev 9716)
+++ trunk/mapbender/owsproxy/http/index.php	2017-03-27 16:25:07 UTC (rev 9717)
@@ -232,6 +232,10 @@
         		$query->setOnlineResource($arrayOnlineresources['wfs_getcapabilities']);
         		$request = $query->getRequest();  
 			$request = str_replace('?&','?',$request);
+			//don't allow get parameters in conjunction with post!
+			if ($postData !== false) {
+				$request = $arrayOnlineresources['wfs_getcapabilities'];
+			}
 			if (isset($auth)) {
             			getWfsCapabilities($request, $auth);
         		} else {
@@ -350,6 +354,10 @@
         } else {
 		$log_id = false;
 	}
+	//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 {
@@ -362,6 +370,10 @@
         $query->setOnlineResource($arrayOnlineresources['wfs_describefeaturetype']);
         $request = $query->getRequest();
         $request = stripslashes($request);
+	//don't allow get parameters in conjunction with post!
+	if ($postData !== false) {
+		$request = $arrayOnlineresources['wfs_describefeaturetype'];
+	}
         if (isset($auth)) {
             describeFeaturetype($request, $auth);
         } else {
@@ -762,19 +774,36 @@
 
 function getWfsCapabilities($request, $auth = false)
 {
-    global $arrayOnlineresources;
+    global $arrayOnlineresources, $postData;
     global $sid, $serviceId;
     $t = array(htmlentities($arrayOnlineresources["wfs_getcapabilities"]), htmlentities($arrayOnlineresources["wfs_getmap"]),
         htmlentities($arrayOnlineresources["wfs_getfeatureinfo"]));
     $new = OWSPROXY . "/" . $sid . "/" . $serviceId . "?";
 	
-    //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");



More information about the Mapbender_commits mailing list