cvs: pear /HTTP_WebDAV_Server Server.php

[email protected] ("Hartmut Holzgraefe")
Newsgroups php.pear.cvs
Message-ID <cvshholzgra1208919365@cvsserver>
hholzgra		Wed Apr 23 02:56:05 2008 UTC

  Modified files:              
    /pear/HTTP_WebDAV_Server	Server.php 
  Log:
  
  - WebDAV has no concept of a query string and clients (including cadaver)
    seem to pass '?' unencoded, so we need to extract the path info out
    of the request URI ourselves
  
  - this together with using rawurlencode() instead of urlencode()
    also solves the double encoding issue reported in pear bug #12283
  
  
  
http://cvs.php.net/viewvc.cgi/pear/HTTP_WebDAV_Server/Server.php?r1=1.71&r2=1.72&diff_format=u
Index: pear/HTTP_WebDAV_Server/Server.php
diff -u pear/HTTP_WebDAV_Server/Server.php:1.71 pear/HTTP_WebDAV_Server/Server.php:1.72
--- pear/HTTP_WebDAV_Server/Server.php:1.71	Wed Feb 20 21:54:36 2008
+++ pear/HTTP_WebDAV_Server/Server.php	Wed Apr 23 02:56:05 2008
@@ -1,4 +1,4 @@
-<?php // $Id: Server.php,v 1.71 2008/02/20 21:54:36 hholzgra Exp $
+<?php // $Id: Server.php,v 1.72 2008/04/23 02:56:05 hholzgra Exp $
 /*
    +----------------------------------------------------------------------+
    | Copyright (c) 2002-2007 Christian Stocker, Hartmut Holzgraefe        |
@@ -163,7 +163,15 @@
         }
         $uri.= "://".$this->_SERVER["HTTP_HOST"].$this->_SERVER["SCRIPT_NAME"];
         
-        $path_info = empty($this->_SERVER["PATH_INFO"]) ? "/" : $this->_SERVER["PATH_INFO"];
+        // WebDAV has no concept of a query string and clients (including cadaver)
+        // seem to pass '?' unencoded, so we need to extract the path info out
+        // of the request URI ourselves
+        $path_info = substr($this->_SERVER["REQUEST_URI"], strlen($this->_SERVER["SCRIPT_NAME"]));
+
+        // just in case the path came in empty ...
+        if (empty($path_info)) {
+            $path_info = "/";
+        }
 
         $this->base_uri = $uri;
         $this->uri      = $uri . $path_info;
@@ -494,7 +502,7 @@
      * OPTIONS method handler
      *
      * The OPTIONS method handler creates a valid OPTIONS reply
-     * including Dav: and Allowed: heaers
+     * including Dav: and Allowed: headers
      * based on the implemented methods found in the actual instance
      *
      * @param  void
@@ -1518,8 +1526,8 @@
 
         $http_header_host = preg_replace("/:80$/", "", $this->_SERVER["HTTP_HOST"]);
 
-        $url = parse_url($this->_SERVER["HTTP_DESTINATION"]);
-        $path      = urldecode($url["path"]);
+        $url  = parse_url($this->_SERVER["HTTP_DESTINATION"]);
+        $path = urldecode($url["path"]);
 
         if (isset($url["host"])) {
             // TODO check url scheme, too
@@ -2037,7 +2045,7 @@
      */
     function _urldecode($path) 
     {
-        return urldecode($path);
+        return rawurldecode($path);
     }
 
     /**
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.