Author: ts
Date: Tue Sep 25 18:50:22 2007
New Revision: 6272

Log:
- Attempt to fix PUT request handling.
- Added test case for it.

Added:
    trunk/Webdav/tests/clients/rfc/put_resource/
    trunk/Webdav/tests/clients/rfc/put_resource/info.txt   (with props)
    trunk/Webdav/tests/clients/rfc/put_resource/request/
    trunk/Webdav/tests/clients/rfc/put_resource/request/body.xml
    trunk/Webdav/tests/clients/rfc/put_resource/request/result.ser   (with 
props)
    trunk/Webdav/tests/clients/rfc/put_resource/request/server.php   (with 
props)
    trunk/Webdav/tests/clients/rfc/put_resource/request/uri.txt   (with props)
    trunk/Webdav/tests/clients/rfc/put_resource/response/
    trunk/Webdav/tests/clients/rfc/put_resource/response/body.xml
    trunk/Webdav/tests/clients/rfc/put_resource/response/code.txt   (with props)
    trunk/Webdav/tests/clients/rfc/put_resource/response/headers.php   (with 
props)
    trunk/Webdav/tests/clients/rfc/put_resource/response/name.txt   (with props)
Removed:
    trunk/Webdav/tests/clients/rfc/options/response/result.ser
Modified:
    trunk/Webdav/src/backend/simple.php
    trunk/Webdav/src/response/put.php
    trunk/Webdav/src/transport.php
    trunk/Webdav/tests/client_test_rfc_backend.php

Modified: trunk/Webdav/src/backend/simple.php
==============================================================================
--- trunk/Webdav/src/backend/simple.php [iso-8859-1] (original)
+++ trunk/Webdav/src/backend/simple.php [iso-8859-1] Tue Sep 25 18:50:22 2007
@@ -969,6 +969,14 @@
     {
         $collection = $request->requestUri;
 
+        if ( $request->body !== null )
+        {
+            return new ezcWebdavErrorResponse(
+                ezcWebdavResponse::STATUS_415,
+                $collection
+            );
+        }
+
         // If resource already exists, the collection cannot be created and a
         // 405 is thrown.
         if ( $this->nodeExists( $collection ) )
@@ -1033,7 +1041,7 @@
      */
     public function options( ezcWebdavOptionsRequest $request )
     {
-        $res = new ezcWebdavOptionsResponse( '1' );
+        $res = new ezcWebdavOptionsResponse( '1, 2' );
         $res->setHeader( 'Allow', 'GET, HEAD, PROPFIND, PROPPATCH, OPTIONS, 
DELETE, COPY, MOVE, MKCOL, PUT' );
         return $res;
     }

Modified: trunk/Webdav/src/response/put.php
==============================================================================
--- trunk/Webdav/src/response/put.php [iso-8859-1] (original)
+++ trunk/Webdav/src/response/put.php [iso-8859-1] Tue Sep 25 18:50:22 2007
@@ -25,7 +25,7 @@
      */
     public function __construct()
     {
-        parent::__construct( ezcWebdavResponse::STATUS_200 );
+        parent::__construct( ezcWebdavResponse::STATUS_201 );
     }
 }
 

Modified: trunk/Webdav/src/transport.php
==============================================================================
--- trunk/Webdav/src/transport.php [iso-8859-1] (original)
+++ trunk/Webdav/src/transport.php [iso-8859-1] Tue Sep 25 18:50:22 2007
@@ -103,7 +103,7 @@
             case 'PROPPATCH':
                 return $this->parsePropPatchRequest( $path, $body );
             case 'PUT':
-                return $this->parsePutReqeuts( $path, $body );
+                return $this->parsePutRequest( $path, $body );
             case 'UNLOCK':
                 return $this->parseUnlockRequest( $path, $body );
             default:
@@ -1328,7 +1328,7 @@
      */
     protected function processPutResponse( ezcWebdavPutResponse $response )
     {
-        return new ezcWebdavDisplayInformation( $response, 
$response->resource->content );
+        return new ezcWebdavDisplayInformation( $response, $response );
     }
 
     /**

Modified: trunk/Webdav/tests/client_test_rfc_backend.php
==============================================================================
--- trunk/Webdav/tests/client_test_rfc_backend.php [iso-8859-1] (original)
+++ trunk/Webdav/tests/client_test_rfc_backend.php [iso-8859-1] Tue Sep 25 
18:50:22 2007
@@ -29,6 +29,7 @@
             case 'options':
             case 'get_collection':
             case 'get_resource':
+            case 'put_resource':
                 return self::getIcsUciSetup1( $test );
             case 'move_resource':
                 return self::getIcsUciSetup2( $test );

Added: trunk/Webdav/tests/clients/rfc/put_resource/info.txt
==============================================================================
--- trunk/Webdav/tests/clients/rfc/put_resource/info.txt (added)
+++ trunk/Webdav/tests/clients/rfc/put_resource/info.txt [iso-8859-1] Tue Sep 
25 18:50:22 2007
@@ -1,0 +1,1 @@
+Test case created manually after information found in 
http://ietf.org/rfc/rfc2518.txt.

Propchange: trunk/Webdav/tests/clients/rfc/put_resource/info.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/Webdav/tests/clients/rfc/put_resource/request/body.xml
==============================================================================
--- trunk/Webdav/tests/clients/rfc/put_resource/request/body.xml (added)
+++ trunk/Webdav/tests/clients/rfc/put_resource/request/body.xml [iso-8859-1] 
Tue Sep 25 18:50:22 2007
@@ -1,0 +1,1 @@
+Test text to put

Added: trunk/Webdav/tests/clients/rfc/put_resource/request/result.ser
==============================================================================
Binary file - no diff available.

Propchange: trunk/Webdav/tests/clients/rfc/put_resource/request/result.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: trunk/Webdav/tests/clients/rfc/put_resource/request/server.php
==============================================================================
--- trunk/Webdav/tests/clients/rfc/put_resource/request/server.php (added)
+++ trunk/Webdav/tests/clients/rfc/put_resource/request/server.php [iso-8859-1] 
Tue Sep 25 18:50:22 2007
@@ -1,0 +1,12 @@
+<?php
+
+return array (
+  'REQUEST_METHOD' => 'PUT',
+  'REQUEST_URI' => '/~fielding/upload.txt',
+  'SERVER_PROTOCOL' => 'HTTP/1.1',
+  'HTTP_HOST' => 'www.ics.uci.edu',
+  'CONTENT_TYPE' => 'text/plain; charset="utf-8"',
+  'HTTP_CONTENT_LENGTH' => '17',
+);
+
+?>

Propchange: trunk/Webdav/tests/clients/rfc/put_resource/request/server.php
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/Webdav/tests/clients/rfc/put_resource/request/uri.txt
==============================================================================
--- trunk/Webdav/tests/clients/rfc/put_resource/request/uri.txt (added)
+++ trunk/Webdav/tests/clients/rfc/put_resource/request/uri.txt [iso-8859-1] 
Tue Sep 25 18:50:22 2007
@@ -1,0 +1,1 @@
+http://www.ics.uci.edu/~fielding/upload.txt

Propchange: trunk/Webdav/tests/clients/rfc/put_resource/request/uri.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/Webdav/tests/clients/rfc/put_resource/response/body.xml
==============================================================================
    (empty)

Added: trunk/Webdav/tests/clients/rfc/put_resource/response/code.txt
==============================================================================
--- trunk/Webdav/tests/clients/rfc/put_resource/response/code.txt (added)
+++ trunk/Webdav/tests/clients/rfc/put_resource/response/code.txt [iso-8859-1] 
Tue Sep 25 18:50:22 2007
@@ -1,0 +1,1 @@
+201

Propchange: trunk/Webdav/tests/clients/rfc/put_resource/response/code.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/Webdav/tests/clients/rfc/put_resource/response/headers.php
==============================================================================
--- trunk/Webdav/tests/clients/rfc/put_resource/response/headers.php (added)
+++ trunk/Webdav/tests/clients/rfc/put_resource/response/headers.php 
[iso-8859-1] Tue Sep 25 18:50:22 2007
@@ -1,0 +1,7 @@
+<?php
+
+return array (
+     0               => 'HTTP/1.1 201 Created',
+);
+
+?>

Propchange: trunk/Webdav/tests/clients/rfc/put_resource/response/headers.php
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/Webdav/tests/clients/rfc/put_resource/response/name.txt
==============================================================================
--- trunk/Webdav/tests/clients/rfc/put_resource/response/name.txt (added)
+++ trunk/Webdav/tests/clients/rfc/put_resource/response/name.txt [iso-8859-1] 
Tue Sep 25 18:50:22 2007
@@ -1,0 +1,1 @@
+Created

Propchange: trunk/Webdav/tests/clients/rfc/put_resource/response/name.txt
------------------------------------------------------------------------------
    svn:eol-style = native


-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to