[Mapbender-commits] r2032 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jan 29 03:45:41 EST 2008


Author: verenadiewald
Date: 2008-01-29 03:45:41 -0500 (Tue, 29 Jan 2008)
New Revision: 2032

Modified:
   trunk/mapbender/http/classes/class_connector.php
Log:
added httpVersion

Modified: trunk/mapbender/http/classes/class_connector.php
===================================================================
--- trunk/mapbender/http/classes/class_connector.php	2008-01-29 08:21:04 UTC (rev 2031)
+++ trunk/mapbender/http/classes/class_connector.php	2008-01-29 08:45:41 UTC (rev 2032)
@@ -33,6 +33,7 @@
 	var $file;	
 	private $connectionType;
 	private $httpType = "get";
+	private $httpVersion = "1.0";
 	private $httpPostData;
 	private $httpContentType;
 		
@@ -83,6 +84,15 @@
 				}
 				break;
 				
+			case "httpVersion":
+				if (in_array($value, array("1.0", "1.1"))) {
+					$this->httpVersion = $value;
+				}
+				else {
+					$e = new mb_exception("class_connector.php: invalid http type '" . $value . "'");
+				}
+				break;
+							
 			case "httpType":
 				if (in_array(mb_strtoupper($value), array("POST", "GET"))) {
 					$this->httpType = $value;
@@ -148,8 +158,8 @@
 	}
 
 	private function getHTTP($url){
-		if ($this->httpType == "get") {
-			return @file_get_contents($url);	
+	 	if ($this->httpType == "get") {
+	 		return @file_get_contents($url);	
 		}
 		else {
 			$urlComponentArray = parse_url($url);
@@ -159,10 +169,9 @@
 				$port = 80;		
 			}	
 			$path = $urlComponentArray["path"];
-			
 			$buf = '';
 		    $fp = fsockopen($host, $port);
-		    fputs($fp, "POST $path HTTP/1.1\r\n");
+		    fputs($fp, "POST $path HTTP/".$this->httpVersion . "\r\n");
 		    fputs($fp, "Host: $host\r\n");
 		    if ($this->isValidHttpContentType($this->httpContentType)) {
 		    	fputs($fp,"Content-type: " . $this->httpContentType . "\r\n");



More information about the Mapbender_commits mailing list