aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/Sabre/HTTP
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/Sabre/HTTP')
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/AWSAuth.php79
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/AbstractAuth.php44
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/BasicAuth.php20
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/DigestAuth.php70
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/Request.php113
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/Response.php53
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/Util.php33
-rwxr-xr-x[-rw-r--r--]3rdparty/Sabre/HTTP/Version.php8
-rwxr-xr-x3rdparty/Sabre/HTTP/includes.php27
9 files changed, 267 insertions, 180 deletions
diff --git a/3rdparty/Sabre/HTTP/AWSAuth.php b/3rdparty/Sabre/HTTP/AWSAuth.php
index 5e4668cd94d..fb8245c8cbf 100644..100755
--- a/3rdparty/Sabre/HTTP/AWSAuth.php
+++ b/3rdparty/Sabre/HTTP/AWSAuth.php
@@ -4,34 +4,34 @@
* HTTP AWS Authentication handler
*
* Use this class to leverage amazon's AWS authentication header
- *
+ *
* @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @subpackage HTTP
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
/**
- * The signature supplied by the HTTP client
- *
- * @var string
+ * The signature supplied by the HTTP client
+ *
+ * @var string
*/
private $signature = null;
/**
- * The accesskey supplied by the HTTP client
- *
- * @var string
+ * The accesskey supplied by the HTTP client
+ *
+ * @var string
*/
private $accessKey = null;
/**
* An error code, if any
*
- * This value will be filled with one of the ERR_* contants
- *
+ * This value will be filled with one of the ERR_* constants
+ *
* @var int
*/
public $errorCode = 0;
@@ -46,8 +46,8 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
* Gathers all information from the headers
*
* This method needs to be called prior to anything else.
- *
- * @return bool
+ *
+ * @return bool
*/
public function init() {
@@ -66,9 +66,9 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
}
/**
- * Returns the username for the request
- *
- * @return string
+ * Returns the username for the request
+ *
+ * @return string
*/
public function getAccessKey() {
@@ -78,8 +78,9 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
/**
* Validates the signature based on the secretKey
- *
- * @return bool
+ *
+ * @param string $secretKey
+ * @return bool
*/
public function validate($secretKey) {
@@ -89,7 +90,7 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
// We need to validate the integrity of the request
$body = $this->httpRequest->getBody(true);
$this->httpRequest->setBody($body,true);
-
+
if ($contentMD5!=base64_encode(md5($body,true))) {
// content-md5 header did not match md5 signature of body
$this->errorCode = self::ERR_MD5CHECKSUMWRONG;
@@ -98,10 +99,10 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
}
- if (!$requestDate = $this->httpRequest->getHeader('x-amz-date'))
+ if (!$requestDate = $this->httpRequest->getHeader('x-amz-date'))
$requestDate = $this->httpRequest->getHeader('Date');
- if (!$this->validateRFC2616Date($requestDate))
+ if (!$this->validateRFC2616Date($requestDate))
return false;
$amzHeaders = $this->getAmzHeaders();
@@ -109,10 +110,10 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
$signature = base64_encode(
$this->hmacsha1($secretKey,
$this->httpRequest->getMethod() . "\n" .
- $contentMD5 . "\n" .
+ $contentMD5 . "\n" .
$this->httpRequest->getHeader('Content-type') . "\n" .
$requestDate . "\n" .
- $amzHeaders .
+ $amzHeaders .
$this->httpRequest->getURI()
)
);
@@ -146,14 +147,14 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
/**
* Makes sure the supplied value is a valid RFC2616 date.
*
- * If we would just use strtotime to get a valid timestamp, we have no way of checking if a
+ * If we would just use strtotime to get a valid timestamp, we have no way of checking if a
* user just supplied the word 'now' for the date header.
*
- * This function also makes sure the Date header is within 15 minutes of the operating
+ * This function also makes sure the Date header is within 15 minutes of the operating
* system date, to prevent replay attacks.
- *
- * @param string $dateHeader
- * @return bool
+ *
+ * @param string $dateHeader
+ * @return bool
*/
protected function validateRFC2616Date($dateHeader) {
@@ -177,11 +178,11 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
return $date;
}
-
+
/**
- * Returns a list of AMZ headers
- *
- * @return void
+ * Returns a list of AMZ headers
+ *
+ * @return string
*/
protected function getAmzHeaders() {
@@ -193,7 +194,7 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
}
}
ksort($amzHeaders);
-
+
$headerStr = '';
foreach($amzHeaders as $h=>$v) {
$headerStr.=$h.':'.$v;
@@ -204,11 +205,11 @@ class Sabre_HTTP_AWSAuth extends Sabre_HTTP_AbstractAuth {
}
/**
- * Generates an HMAC-SHA1 signature
- *
- * @param string $key
- * @param string $message
- * @return string
+ * Generates an HMAC-SHA1 signature
+ *
+ * @param string $key
+ * @param string $message
+ * @return string
*/
private function hmacsha1($key, $message) {
diff --git a/3rdparty/Sabre/HTTP/AbstractAuth.php b/3rdparty/Sabre/HTTP/AbstractAuth.php
index eb528f6fdee..3bccabcd1c1 100644..100755
--- a/3rdparty/Sabre/HTTP/AbstractAuth.php
+++ b/3rdparty/Sabre/HTTP/AbstractAuth.php
@@ -4,10 +4,10 @@
* HTTP Authentication baseclass
*
* This class has the common functionality for BasicAuth and DigestAuth
- *
+ *
* @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @subpackage HTTP
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
@@ -17,29 +17,29 @@ abstract class Sabre_HTTP_AbstractAuth {
* The realm will be displayed in the dialog boxes
*
* This identifier can be changed through setRealm()
- *
+ *
* @var string
*/
protected $realm = 'SabreDAV';
/**
- * HTTP response helper
- *
- * @var Sabre_HTTP_Response
+ * HTTP response helper
+ *
+ * @var Sabre_HTTP_Response
*/
protected $httpResponse;
/**
- * HTTP request helper
- *
- * @var Sabre_HTTP_Request
+ * HTTP request helper
+ *
+ * @var Sabre_HTTP_Request
*/
protected $httpRequest;
/**
- * __construct
- *
+ * __construct
+ *
*/
public function __construct() {
@@ -49,9 +49,9 @@ abstract class Sabre_HTTP_AbstractAuth {
}
/**
- * Sets an alternative HTTP response object
- *
- * @param Sabre_HTTP_Response $response
+ * Sets an alternative HTTP response object
+ *
+ * @param Sabre_HTTP_Response $response
* @return void
*/
public function setHTTPResponse(Sabre_HTTP_Response $response) {
@@ -61,9 +61,9 @@ abstract class Sabre_HTTP_AbstractAuth {
}
/**
- * Sets an alternative HTTP request object
- *
- * @param Sabre_HTTP_Request $request
+ * Sets an alternative HTTP request object
+ *
+ * @param Sabre_HTTP_Request $request
* @return void
*/
public function setHTTPRequest(Sabre_HTTP_Request $request) {
@@ -78,8 +78,8 @@ abstract class Sabre_HTTP_AbstractAuth {
*
* The realm is often displayed in authentication dialog boxes
* Commonly an application name displayed here
- *
- * @param string $realm
+ *
+ * @param string $realm
* @return void
*/
public function setRealm($realm) {
@@ -91,7 +91,7 @@ abstract class Sabre_HTTP_AbstractAuth {
/**
* Returns the realm
*
- * @return string
+ * @return string
*/
public function getRealm() {
@@ -106,6 +106,6 @@ abstract class Sabre_HTTP_AbstractAuth {
*
* @return void
*/
- abstract public function requireLogin();
+ abstract public function requireLogin();
}
diff --git a/3rdparty/Sabre/HTTP/BasicAuth.php b/3rdparty/Sabre/HTTP/BasicAuth.php
index 35c22d22dc3..a747cc6a31b 100644..100755
--- a/3rdparty/Sabre/HTTP/BasicAuth.php
+++ b/3rdparty/Sabre/HTTP/BasicAuth.php
@@ -4,11 +4,11 @@
* HTTP Basic Authentication handler
*
* Use this class for easy http authentication setup
- *
+ *
* @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @subpackage HTTP
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_HTTP_BasicAuth extends Sabre_HTTP_AbstractAuth {
@@ -22,7 +22,7 @@ class Sabre_HTTP_BasicAuth extends Sabre_HTTP_AbstractAuth {
*
* If nothing was supplied, 'false' will be returned
*
- * @return mixed
+ * @return mixed
*/
public function getUserPass() {
@@ -33,12 +33,18 @@ class Sabre_HTTP_BasicAuth extends Sabre_HTTP_AbstractAuth {
}
- // Most other webservers
+ // Most other webservers
$auth = $this->httpRequest->getHeader('Authorization');
+ // Apache could prefix environment variables with REDIRECT_ when urls
+ // are passed through mod_rewrite
+ if (!$auth) {
+ $auth = $this->httpRequest->getRawServerValue('REDIRECT_HTTP_AUTHORIZATION');
+ }
+
if (!$auth) return false;
- if (strpos(strtolower($auth),'basic')!==0) return false;
+ if (strpos(strtolower($auth),'basic')!==0) return false;
return explode(':', base64_decode(substr($auth, 6)));
diff --git a/3rdparty/Sabre/HTTP/DigestAuth.php b/3rdparty/Sabre/HTTP/DigestAuth.php
index 5e755929571..ee7f05c08ed 100644..100755
--- a/3rdparty/Sabre/HTTP/DigestAuth.php
+++ b/3rdparty/Sabre/HTTP/DigestAuth.php
@@ -10,18 +10,18 @@
* 2. Call the setRealm() method with the realm you plan to use
* 3. Call the init method function.
* 4. Call the getUserName() function. This function may return false if no
- * authentication information was supplied. Based on the username you
+ * authentication information was supplied. Based on the username you
* should check your internal database for either the associated password,
* or the so-called A1 hash of the digest.
* 5. Call either validatePassword() or validateA1(). This will return true
- * or false.
+ * or false.
* 6. To make sure an authentication prompt is displayed, call the
* requireLogin() method.
- *
- *
+ *
+ *
* @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @subpackage HTTP
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
@@ -40,7 +40,7 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
protected $qop = self::QOP_AUTH;
/**
- * Initializes the object
+ * Initializes the object
*/
public function __construct() {
@@ -54,7 +54,7 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
* Gathers all information from the headers
*
* This method needs to be called prior to anything else.
- *
+ *
* @return void
*/
public function init() {
@@ -73,11 +73,11 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
*
* Multiple values can be specified using logical OR.
*
- * QOP_AUTHINT ensures integrity of the request body, but this is not
- * supported by most HTTP clients. QOP_AUTHINT also requires the entire
+ * QOP_AUTHINT ensures integrity of the request body, but this is not
+ * supported by most HTTP clients. QOP_AUTHINT also requires the entire
* request body to be md5'ed, which can put strains on CPU and memory.
*
- * @param int $qop
+ * @param int $qop
* @return void
*/
public function setQOP($qop) {
@@ -91,8 +91,8 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
*
* The A1 parameter should be md5($username . ':' . $realm . ':' . $password);
*
- * @param string $A1
- * @return bool
+ * @param string $A1
+ * @return bool
*/
public function validateA1($A1) {
@@ -104,9 +104,9 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
/**
* Validates authentication through a password. The actual password must be provided here.
* It is strongly recommended not store the password in plain-text and use validateA1 instead.
- *
- * @param string $password
- * @return bool
+ *
+ * @param string $password
+ * @return bool
*/
public function validatePassword($password) {
@@ -116,9 +116,9 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
}
/**
- * Returns the username for the request
- *
- * @return string
+ * Returns the username for the request
+ *
+ * @return string
*/
public function getUsername() {
@@ -127,14 +127,14 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
}
/**
- * Validates the digest challenge
- *
- * @return bool
+ * Validates the digest challenge
+ *
+ * @return bool
*/
protected function validate() {
$A2 = $this->httpRequest->getMethod() . ':' . $this->digestParts['uri'];
-
+
if ($this->digestParts['qop']=='auth-int') {
// Making sure we support this qop value
if (!($this->qop & self::QOP_AUTHINT)) return false;
@@ -144,16 +144,16 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
$A2 .= ':' . md5($body);
} else {
- // We need to make sure we support this qop value
- if (!($this->qop & self::QOP_AUTH)) return false;
+ // We need to make sure we support this qop value
+ if (!($this->qop & self::QOP_AUTH)) return false;
}
$A2 = md5($A2);
- $validResponse = md5("{$this->A1}:{$this->digestParts['nonce']}:{$this->digestParts['nc']}:{$this->digestParts['cnonce']}:{$this->digestParts['qop']}:{$A2}");
+ $validResponse = md5("{$this->A1}:{$this->digestParts['nonce']}:{$this->digestParts['nc']}:{$this->digestParts['cnonce']}:{$this->digestParts['qop']}:{$A2}");
return $this->digestParts['response']==$validResponse;
-
+
}
@@ -186,7 +186,7 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
*
* If the header could not be found, null will be returned
*
- * @return mixed
+ * @return mixed
*/
public function getDigest() {
@@ -197,6 +197,12 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
// most other servers
$digest = $this->httpRequest->getHeader('Authorization');
+ // Apache could prefix environment variables with REDIRECT_ when urls
+ // are passed through mod_rewrite
+ if (!$digest) {
+ $digest = $this->httpRequest->getRawServerValue('REDIRECT_HTTP_AUTHORIZATION');
+ }
+
if ($digest && strpos(strtolower($digest),'digest')===0) {
return substr($digest,7);
} else {
@@ -208,11 +214,11 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
/**
* Parses the different pieces of the digest string into an array.
- *
+ *
* This method returns false if an incomplete digest was supplied
*
- * @param string $digest
- * @return mixed
+ * @param string $digest
+ * @return mixed
*/
protected function parseDigest($digest) {
@@ -227,7 +233,7 @@ class Sabre_HTTP_DigestAuth extends Sabre_HTTP_AbstractAuth {
unset($needed_parts[$m[1]]);
}
- return $needed_parts ? false : $data;
+ return $needed_parts ? false : $data;
}
diff --git a/3rdparty/Sabre/HTTP/Request.php b/3rdparty/Sabre/HTTP/Request.php
index 95a64171aab..4746ef77704 100644..100755
--- a/3rdparty/Sabre/HTTP/Request.php
+++ b/3rdparty/Sabre/HTTP/Request.php
@@ -6,74 +6,85 @@
* This object can be used to easily access information about an HTTP request.
* It can additionally be used to create 'mock' requests.
*
- * This class mostly operates indepentend, but because of the nature of a single
- * request per run it can operate as a singleton. For more information check out
+ * This class mostly operates independent, but because of the nature of a single
+ * request per run it can operate as a singleton. For more information check out
* the behaviour around 'defaultInputStream'.
*
* @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @subpackage HTTP
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_HTTP_Request {
/**
* PHP's $_SERVER data
- *
- * @var string
+ *
+ * @var array
*/
protected $_SERVER;
/**
+ * PHP's $_POST data
+ *
+ * @var array
+ */
+ protected $_POST;
+
+ /**
* The request body, if any.
*
* This is stored in the form of a stream resource.
*
- * @var resource
+ * @var resource
*/
protected $body = null;
/**
* This will be set as the 'default' inputStream for a specific HTTP request
- * We sometimes need to retain, or rebuild this if we need multiple runs
+ * We sometimes need to retain, or rebuild this if we need multiple runs
* of parsing the original HTTP request.
- *
- * @var resource
+ *
+ * @var resource
*/
static $defaultInputStream=null;
/**
* Sets up the object
*
- * The serverData array can be used to override usage of PHP's
- * global _SERVER variable.
- *
- * @param array $serverData
+ * The serverData and postData array can be used to override usage of PHP's
+ * global _SERVER and _POST variable respectively.
+ *
+ * @param array $serverData
+ * @param array $postData
*/
- public function __construct($serverData = null) {
+ public function __construct(array $serverData = null, array $postData = null) {
if ($serverData) $this->_SERVER = $serverData;
else $this->_SERVER =& $_SERVER;
+ if ($postData) $this->_POST = $postData;
+ else $this->_POST =& $_POST;
+
}
/**
* Returns the value for a specific http header.
*
* This method returns null if the header did not exist.
- *
- * @param string $name
- * @return string
+ *
+ * @param string $name
+ * @return string
*/
public function getHeader($name) {
$name = strtoupper(str_replace(array('-'),array('_'),$name));
if (isset($this->_SERVER['HTTP_' . $name])) {
return $this->_SERVER['HTTP_' . $name];
- }
+ }
- // There's a few headers that seem to end up in the top-level
+ // There's a few headers that seem to end up in the top-level
// server array.
switch($name) {
case 'CONTENT_TYPE' :
@@ -92,9 +103,9 @@ class Sabre_HTTP_Request {
* Returns all (known) HTTP headers.
*
* All headers are converted to lower-case, and additionally all underscores
- * are automatically converted to dashes
- *
- * @return array
+ * are automatically converted to dashes
+ *
+ * @return array
*/
public function getHeaders() {
@@ -122,9 +133,9 @@ class Sabre_HTTP_Request {
/**
* Returns the HTTP request method
*
- * This is for example POST or GET
+ * This is for example POST or GET
*
- * @return string
+ * @return string
*/
public function getMethod() {
@@ -135,18 +146,18 @@ class Sabre_HTTP_Request {
/**
* Returns the requested uri
*
- * @return string
+ * @return string
*/
public function getUri() {
-
+
return $this->_SERVER['REQUEST_URI'];
}
/**
- * Will return protocol + the hostname + the uri
- *
- * @return void
+ * Will return protocol + the hostname + the uri
+ *
+ * @return string
*/
public function getAbsoluteUri() {
@@ -157,9 +168,9 @@ class Sabre_HTTP_Request {
}
/**
- * Returns everything after the ? from the current url
- *
- * @return string
+ * Returns everything after the ? from the current url
+ *
+ * @return string
*/
public function getQueryString() {
@@ -168,13 +179,13 @@ class Sabre_HTTP_Request {
}
/**
- * Returns the HTTP request body body
+ * Returns the HTTP request body body
*
* This method returns a readable stream resource.
- * If the asString parameter is set to true, a string is sent instead.
+ * If the asString parameter is set to true, a string is sent instead.
*
* @param bool asString
- * @return resource
+ * @return resource
*/
public function getBody($asString = false) {
@@ -196,14 +207,14 @@ class Sabre_HTTP_Request {
}
/**
- * Sets the contents of the HTTP request body
- *
+ * Sets the contents of the HTTP request body
+ *
* This method can either accept a string, or a readable stream resource.
*
- * If the setAsDefaultInputStream is set to true, it means for this run of the
+ * If the setAsDefaultInputStream is set to true, it means for this run of the
* script the supplied body will be used instead of php://input.
*
- * @param mixed $body
+ * @param mixed $body
* @param bool $setAsDefaultInputStream
* @return void
*/
@@ -226,12 +237,26 @@ class Sabre_HTTP_Request {
}
/**
- * Returns a specific item from the _SERVER array.
+ * Returns PHP's _POST variable.
+ *
+ * The reason this is in a method is so it can be subclassed and
+ * overridden.
+ *
+ * @return array
+ */
+ public function getPostVars() {
+
+ return $this->_POST;
+
+ }
+
+ /**
+ * Returns a specific item from the _SERVER array.
*
* Do not rely on this feature, it is for internal use only.
*
- * @param string $field
- * @return string
+ * @param string $field
+ * @return string
*/
public function getRawServerValue($field) {
diff --git a/3rdparty/Sabre/HTTP/Response.php b/3rdparty/Sabre/HTTP/Response.php
index dce6feac553..ffe9bda2082 100644..100755
--- a/3rdparty/Sabre/HTTP/Response.php
+++ b/3rdparty/Sabre/HTTP/Response.php
@@ -1,20 +1,20 @@
<?php
/**
- * Sabre_HTTP_Response
- *
+ * Sabre_HTTP_Response
+ *
* @package Sabre
* @subpackage HTTP
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
- * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_HTTP_Response {
/**
- * Returns a full HTTP status message for an HTTP status code
- *
- * @param int $code
+ * Returns a full HTTP status message for an HTTP status code
+ *
+ * @param int $code
* @return string
*/
public function getStatusMessage($code) {
@@ -64,6 +64,9 @@ class Sabre_HTTP_Response {
423 => 'Locked', // RFC 4918
424 => 'Failed Dependency', // RFC 4918
426 => 'Upgrade required',
+ 428 => 'Precondition required', // draft-nottingham-http-new-status
+ 429 => 'Too Many Requests', // draft-nottingham-http-new-status
+ 431 => 'Request Header Fields Too Large', // draft-nottingham-http-new-status
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
@@ -71,25 +74,26 @@ class Sabre_HTTP_Response {
504 => 'Gateway Timeout',
505 => 'HTTP Version not supported',
506 => 'Variant Also Negotiates',
- 507 => 'Unsufficient Storage', // RFC 4918
+ 507 => 'Insufficient Storage', // RFC 4918
508 => 'Loop Detected', // RFC 5842
509 => 'Bandwidth Limit Exceeded', // non-standard
510 => 'Not extended',
- );
+ 511 => 'Network Authentication Required', // draft-nottingham-http-new-status
+ );
return 'HTTP/1.1 ' . $code . ' ' . $msg[$code];
}
/**
- * Sends an HTTP status header to the client
- *
- * @param int $code HTTP status code
- * @return void
+ * Sends an HTTP status header to the client
+ *
+ * @param int $code HTTP status code
+ * @return bool
*/
public function sendStatus($code) {
- if (!headers_sent())
+ if (!headers_sent())
return header($this->getStatusMessage($code));
else return false;
@@ -97,15 +101,16 @@ class Sabre_HTTP_Response {
/**
* Sets an HTTP header for the response
- *
- * @param string $name
- * @param string $value
- * @return void
+ *
+ * @param string $name
+ * @param string $value
+ * @param bool $replace
+ * @return bool
*/
public function setHeader($name, $value, $replace = true) {
$value = str_replace(array("\r","\n"),array('\r','\n'),$value);
- if (!headers_sent())
+ if (!headers_sent())
return header($name . ': ' . $value, $replace);
else return false;
@@ -115,8 +120,8 @@ class Sabre_HTTP_Response {
* Sets a bunch of HTTP Headers
*
* headersnames are specified as keys, value in the array value
- *
- * @param array $headers
+ *
+ * @param array $headers
* @return void
*/
public function setHeaders(array $headers) {
@@ -130,14 +135,14 @@ class Sabre_HTTP_Response {
* Sends the entire response body
*
* This method can accept either an open filestream, or a string.
- *
- * @param mixed $body
+ *
+ * @param mixed $body
* @return void
*/
public function sendBody($body) {
if (is_resource($body)) {
-
+
fpassthru($body);
} else {
diff --git a/3rdparty/Sabre/HTTP/Util.php b/3rdparty/Sabre/HTTP/Util.php
index 8a6bd7df487..67bdd489e1e 100644..100755
--- a/3rdparty/Sabre/HTTP/Util.php
+++ b/3rdparty/Sabre/HTTP/Util.php
@@ -1,11 +1,11 @@
<?php
/**
- * HTTP utility methods
- *
+ * HTTP utility methods
+ *
* @package Sabre
* @subpackage HTTP
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @author Paul Voegler
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
@@ -16,9 +16,9 @@ class Sabre_HTTP_Util {
* Parses a RFC2616-compatible date string
*
* This method returns false if the date is invalid
- *
- * @param string $dateHeader
- * @return bool|DateTime
+ *
+ * @param string $dateHeader
+ * @return bool|DateTime
*/
static function parseHTTPDate($dateHeader) {
@@ -42,7 +42,7 @@ class Sabre_HTTP_Util {
$rfc1123_date = $wkday . ', ' . $date1 . ' ' . $time . ' GMT';
//allowed date formats by RFC 2616
$HTTP_date = "($rfc1123_date|$rfc850_date|$asctime_date)";
-
+
//allow for space around the string and strip it
$dateHeader = trim($dateHeader, ' ');
if (!preg_match('/^' . $HTTP_date . '$/', $dateHeader))
@@ -58,7 +58,24 @@ class Sabre_HTTP_Util {
if ($realDate !== false && $realDate >= 0)
return new DateTime('@' . $realDate, new DateTimeZone('UTC'));
- return false;
+ }
+
+ /**
+ * Transforms a DateTime object to HTTP's most common date format.
+ *
+ * We're serializing it as the RFC 1123 date, which, for HTTP must be
+ * specified as GMT.
+ *
+ * @param DateTime $dateTime
+ * @return string
+ */
+ static function toHTTPDate(DateTime $dateTime) {
+
+ // We need to clone it, as we don't want to affect the existing
+ // DateTime.
+ $dateTime = clone $dateTime;
+ $dateTime->setTimeZone(new DateTimeZone('GMT'));
+ return $dateTime->format('D, d M Y H:i:s \G\M\T');
}
diff --git a/3rdparty/Sabre/HTTP/Version.php b/3rdparty/Sabre/HTTP/Version.php
index 67be232fc26..23dc7f8a7a1 100644..100755
--- a/3rdparty/Sabre/HTTP/Version.php
+++ b/3rdparty/Sabre/HTTP/Version.php
@@ -2,10 +2,10 @@
/**
* This class contains the Sabre_HTTP version constants.
- *
+ *
* @package Sabre
- * @subpackage HTTP
- * @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
+ * @subpackage HTTP
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
@@ -14,7 +14,7 @@ class Sabre_HTTP_Version {
/**
* Full version number
*/
- const VERSION = '1.5.3';
+ const VERSION = '1.6.2';
/**
* Stability : alpha, beta, stable
diff --git a/3rdparty/Sabre/HTTP/includes.php b/3rdparty/Sabre/HTTP/includes.php
new file mode 100755
index 00000000000..9d34bf3a8be
--- /dev/null
+++ b/3rdparty/Sabre/HTTP/includes.php
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * Sabre_HTTP includes file
+ *
+ * Including this file will automatically include all files from the Sabre_HTTP
+ * package.
+ *
+ * This often allows faster loadtimes, as autoload-speed is often quite slow.
+ *
+ * @package Sabre
+ * @subpackage HTTP
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+
+// Begin includes
+include __DIR__ . '/AbstractAuth.php';
+include __DIR__ . '/AWSAuth.php';
+include __DIR__ . '/BasicAuth.php';
+include __DIR__ . '/DigestAuth.php';
+include __DIR__ . '/Request.php';
+include __DIR__ . '/Response.php';
+include __DIR__ . '/Util.php';
+include __DIR__ . '/Version.php';
+// End includes