Webdav: ezcWebdavHeaderHandler
[ ]
[ Clients ] [ Plugin architecture ]
[ ]
[ ]
[ ]
[ ]
Class: ezcWebdavHeaderHandler
|
An instance of this class manages header parsing and handling. [
source]
An object of this class takes care about headers in
ezcWebdavTransport. It is responsible for parsing incoming headers and serialize outgoing ones. Like for the
ezcWebdavPropertyHandler, the instance of this class that is used in the current transport layer must be accessable for plugins.
Member Variables
|
protected array(string) |
$defaultHeaders
= array( 'Authorization', 'If-Match', 'If-None-Match', )
List of headers that should be attempted to parse for every request. |
|
protected array(string=>string) |
$headerMap
= array( 'Authorization' => array( 'HTTP_AUTHORIZATION', 'PHP_AUTH_DIGEST', 'PHP_AUTH_USER', ),'Content-Length'=>array('HTTP_CONTENT_LENGTH','CONTENT_LENGTH',),'Content-Type'=>array('CONTENT_TYPE',),'Depth'=>array('HTTP_DEPTH',),'Destination'=>array('HTTP_DESTINATION',),'If-Match'=>array('HTTP_IF_MATCH'),'If-None-Match'=>array('HTTP_IF_NONE_MATCH'),'Overwrite'=>array('HTTP_OVERWRITE',),'Server'=>array('SERVER_SOFTWARE',),)
Map of regular header names to $_SERVER keys. |
Method Summary
Methods
parseAuthorizationHeader
array(string) parseAuthorizationHeader(
string
$value, string
$serverHeaderName )
Parses the Authorization header.
Takes the string value of the Authorization header and parses it according to the Basic authentication scheme. The return value is an struct of either of the following classes:
In case the header is provided but does not contain a parseable value, the user and pass fields are null. The $serverHeaderName parameter indicates, which key from the $_SERVER array was used to extract the header.
Parameters
| Name |
Type |
Description |
$value |
string |
|
$serverHeaderName |
string |
|
parseBasicAuthorizationHeader
Parses the basic authorization header.
Returns a struct of type
ezcWebdavBasicAuth, containing the parsed values, or with empty username and password, if the header could not be parsed.
Parameters
| Name |
Type |
Description |
$value |
string |
|
parseDepthHeader
int|string parseDepthHeader(
string
$value )
Parses the Depth header.
Parses the values '0', '1' and 'infinity' into the corresponding constants:
- {@linkezcWebdavRequest::DEPTH_ZERO}
- {@linkezcWebdavRequest::DEPTH_ONE}
- {@linkezcWebdavRequest::DEPTH_INFINITY}
If the header contains a different value it is left as is.
Parameters
| Name |
Type |
Description |
$value |
string |
|
parseDigestAuthorizationHeader
Parses the digest authorization header.
Returns an authorization credential struct of type
ezcWebdavDigestAuth, containing the parsed data, or an instance of
ezcWebdavBasicAuth with empty username and password, if parsing failed.
Parameters
| Name |
Type |
Description |
$value |
string |
|
parseHeader
mixed parseHeader(
string
$headerName )
Parses a single header.
Retrieves a $headerName and returns the processed value for it, if it does exist. If the requested header is unknown, a
ezcWebdavUnknownHeaderException is thrown. If the requested header is not present in $_SERVER null is returned.
Parameters
| Name |
Type |
Description |
$headerName |
string |
|
parseHeaders
array(string=>mixed) parseHeaders(
[
$headerNames = array()], [
$defaultHeaders = true], bool
$defaultHeaders
)
Returns an array with the given headers.
Checks for the availability of headers in $headerNamess, given as an array of header names, and parses them according to their format.
By default, this method parses an additional set of default headers (e.g. If-Match and If-None-Match). This can be avoided by setting the optional $defaultHeaders parameter to false.
The returned array can be used with ezcWebdavRequest->setHeaders().
Parameters
| Name |
Type |
Description |
$headerNames |
array(string) |
|
$defaultHeaders
|
bool |
|
$defaultHeaders |
|
|
Throws
| Class | Description |
ezcWebdavUnknownHeaderException |
if a header requested in $headerNames is not known in $headerNames. |
parseIfMatchHeader
array parseIfMatchHeader(
string
$value )
Parses the If-Match and If-None-Match headers.
We do not pay attention to weak entity tags (prefixed by W\), since our backends don't make use of such tags. If backends want to provide weak entity tags, they still might do so.
Parameters
| Name |
Type |
Description |
$value |
string |
|
processHeader
mixed processHeader(
string
$headerName, string
$value, string
$serverHeaderName )
Processes a single header value.
Takes the $headerName and $value of a header and parses the value accordingly, * if necessary. Returns the parsed or unmanipuled result. The $serverHeaderName parameter contains the key that was used to extract the header from the $_SERVER array.
Parameters
| Name |
Type |
Description |
$headerName |
string |
|
$value |
string |
|
$serverHeaderName |
string |
|
Last updated: Mon, 05 Jan 2009