Author: ts
Date: Tue Sep 25 17:42:39 2007
New Revision: 6271
Log:
- Slightly refactored final sending method.
# Hey, cadaver -t lets me create collections! :)
Modified:
trunk/Webdav/src/transport.php
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 17:42:39 2007
@@ -1122,6 +1122,11 @@
{
case ( $info->body instanceof DOMDocument ):
$info->body->formatOutput = true;
+ // Explicitly set txt/xml content type
+ if ( $info->response->getHeader( 'Content-Type' ) === null )
+ {
+ $info->response->setHeader( 'Content-Type', 'text/xml;
charset="utf-8"' );
+ }
$result = $info->body->saveXML( $info->body );
break;
case ( is_string( $info->body ) ):
@@ -1129,12 +1134,12 @@
break;
case ( $info->body === null ):
default:
- $result = '';
+ $result = null;
break;
}
- // Sends HTTP response code and description
- header( (string) $info->response );
+ // Sends HTTP response code and description, 3rd param forces status
+ header( (string) $info->response, true, (int) $info->response->status
);
// Send headers defined by response
$headers = $info->response->getHeaders();
@@ -1143,10 +1148,11 @@
header( "{$name}: {$value}" );
}
- // Do we need to explictly send the Content-Length header here?
-
- echo $result;
- // All done
+ if ( $result !== null )
+ {
+ // Content-Length header automatically send
+ echo $result;
+ }
}
/**
@@ -1501,7 +1507,7 @@
break;
case 'ezcWebdavResourceTypeProperty':
$elementName = 'resourcetype';
- $elementValue = ( $property->type ===
ezcWebdavResourceTypeProperty::TYPE_COLLECTION ? $this->newDomElement(
$parentElement->ownerDocument, 'collection' ) : null );
+ $elementValue = ( $property->type ===
ezcWebdavResourceTypeProperty::TYPE_COLLECTION ? array( $this->newDomElement(
$parentElement->ownerDocument, 'collection' ) ) : null );
break;
case 'ezcWebdavSourceProperty':
$elementName = 'source';
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components