cvs: pear /HTTP_WebDAV_Client/Client Stream.php

From: Date: Wed, 07 Apr 2004 18:33:38 +0000
Subject: cvs: pear /HTTP_WebDAV_Client/Client Stream.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-17990@lists.php.net to get a copy of this message
hholzgra Wed Apr 7 14:33:38 2004 EDT Modified files: /pear/HTTP_WebDAV_Client/Client Stream.php Log: truncate file by doing an empty PUT when 'w' in fopen mode (PEAR Bug #996) http://cvs.php.net/diff.php/pear/HTTP_WebDAV_Client/Client/Stream.php?r1=1.4&r2=1.5&ty=u Index: pear/HTTP_WebDAV_Client/Client/Stream.php diff -u pear/HTTP_WebDAV_Client/Client/Stream.php:1.4 pear/HTTP_WebDAV_Client/Client/Stream.php:1.5 --- pear/HTTP_WebDAV_Client/Client/Stream.php:1.4 Wed Apr 7 14:00:40 2004 +++ pear/HTTP_WebDAV_Client/Client/Stream.php Wed Apr 7 14:33:38 2004 @@ -173,7 +173,18 @@ error_log("file not found: ".$req->getResponseCode()); return false; } + + // 'w' -> open for writing, truncate existing files + if (strpos($mode, "w") !== false) { + $req = &new HTTP_Request($this->url); + $req->setMethod(HTTP_REQUEST_METHOD_PUT); + if (is_string($this->user)) { + $req->setBasicAuth($this->user, @$this->pass); + } + $req->sendRequest(); + } + // 'a' -> open for appending if (strpos($mode, "a") !== false) { $this->eof = true; }

« previous php.pear.cvs (#17990) next »