PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTTP » HTTP_WebDAV_Client » Bug #995

Support for WebDAV authentication is lacking

Details

Submitted2004-03-11 11:42 UTC
Froms dot binge at codefusion dot co dot za
Assignedhholzgra
StatusClosed
PackageHTTP_WebDAV_Client
PHP Version4.3.4
OSAny
Roadmaps(Not assigned)

Comments

[2004-03-11 11:42 UTC] s dot binge at codefusion dot co dot za

Description:
------------
When opening a WebDAV stream using authentication information (e.g. fopen("webdav://user:pass@my.webdav.server/file.dat")) the function fails if the username or password contains an '@' character .

The code appears to interpret the first '@' character as the end of the authentication information.

Reproduce code:
---------------
fopen("webdav://user@host.com:p@ssword@my.webdav.server/file.dat"

Expected result:
----------------
The filestream should successfully be opened using authentication username 'user@host.com' and password 'p@ssword' (assuming the user has the relevant rights on the server).

Actual result:
--------------
PHP Warning: fopen(webdav://...@my.webdav.server/file.dat): failed to open stream: "http_webdav_client_stream::stream_open" call failed in /test.php on line XX

[2004-03-11 11:50 UTC] s dot binge at codefusion dot co dot za

A possible solution is to urlencode() the username and password in the webdav URL, meaning the first '@' symbol does denote the end of the authentication information, as any other '@' symbols that were present were encoded. This requires the following patch to the WebDAV class in order to support urlencode()'ed authentication information:

--- Stream.php.old 2003-12-20 03:00:15.000000000 +0200
+++ Stream.php 2004-01-28 13:51:27.000000000 +0200
@@ -757,10 +757,10 @@

// extract authentication information
if (isset($url['user'])) {
- $this->user = $url['user'];
+ $this->user = urldecode($url['user']);
}
if (isset($url['pass'])) {
- $this->pass = $url['pass'];
+ $this->pass = urldecode($url['pass']);
}

return true;