Kohana v3.3.2

This commit is contained in:
Deon George
2014-09-06 23:43:07 +10:00
parent f96694b18f
commit 8888719653
236 changed files with 1685 additions and 996 deletions

View File

@@ -2,7 +2,7 @@
/**
* [Request_Client_External] Curl driver performs external requests using the
* php-curl extention. This is the default driver for all external requests.
*
*
* @package Kohana
* @category Base
* @author Kohana Team
@@ -63,7 +63,7 @@ class Kohana_Request_Client_Curl extends Request_Client_External {
$this->_options[CURLOPT_RETURNTRANSFER] = TRUE;
$this->_options[CURLOPT_HEADER] = FALSE;
// Apply any additional options set to
// Apply any additional options set to
$options += $this->_options;
$uri = $request->uri();
@@ -110,8 +110,9 @@ class Kohana_Request_Client_Curl extends Request_Client_External {
}
/**
* Sets the appropriate curl request options. Uses the responding options
* for POST and PUT, uses CURLOPT_CUSTOMREQUEST otherwise
* Sets the appropriate curl request options. Uses the responding option
* for POST or CURLOPT_CUSTOMREQUEST otherwise
*
* @param Request $request
* @param array $options
* @return array
@@ -122,9 +123,6 @@ class Kohana_Request_Client_Curl extends Request_Client_External {
case Request::POST:
$options[CURLOPT_POST] = TRUE;
break;
case Request::PUT:
$options[CURLOPT_PUT] = TRUE;
break;
default:
$options[CURLOPT_CUSTOMREQUEST] = $request->method();
break;
@@ -132,4 +130,4 @@ class Kohana_Request_Client_Curl extends Request_Client_External {
return $options;
}
} // End Kohana_Request_Client_Curl
}

View File

@@ -3,25 +3,25 @@
* [Request_Client_External] provides a wrapper for all external request
* processing. This class should be extended by all drivers handling external
* requests.
*
*
* Supported out of the box:
* - Curl (default)
* - PECL HTTP
* - Streams
*
*
* To select a specific external driver to use as the default driver, set the
* following property within the Application bootstrap. Alternatively, the
* client can be injected into the request object.
*
*
* @example
*
*
* // In application bootstrap
* Request_Client_External::$client = 'Request_Client_Stream';
*
*
* // Add client to request
* $request = Request::factory('http://some.host.tld/foo/bar')
* ->client(Request_Client_External::factory('Request_Client_HTTP));
*
*
* @package Kohana
* @category Base
* @author Kohana Team
@@ -36,7 +36,7 @@ abstract class Kohana_Request_Client_External extends Request_Client {
* - Request_Client_Curl (default)
* - Request_Client_HTTP
* - Request_Client_Stream
*
*
* @var string defines the external client to use by default
*/
public static $client = 'Request_Client_Curl';
@@ -45,7 +45,7 @@ abstract class Kohana_Request_Client_External extends Request_Client {
* Factory method to create a new Request_Client_External object based on
* the client name passed, or defaulting to Request_Client_External::$client
* by default.
*
*
* Request_Client_External::$client can be set in the application bootstrap.
*
* @param array $params parameters to pass to the client
@@ -124,7 +124,7 @@ abstract class Kohana_Request_Client_External extends Request_Client {
if ($post = $request->post())
{
$request->body(http_build_query($post, NULL, '&'))
->headers('content-type', 'application/x-www-form-urlencoded');
->headers('content-type', 'application/x-www-form-urlencoded; charset='.Kohana::$charset);
}
// If Kohana expose, set the user-agent
@@ -204,4 +204,4 @@ abstract class Kohana_Request_Client_External extends Request_Client {
*/
abstract protected function _send_message(Request $request, Response $response);
} // End Kohana_Request_Client_External
}

View File

@@ -1,14 +1,14 @@
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* [Request_Client_External] HTTP driver performs external requests using the
* php-http extention. To use this driver, ensure the following is completed
* php-http extension. To use this driver, ensure the following is completed
* before executing an external request- ideally in the application bootstrap.
*
*
* @example
*
*
* // In application bootstrap
* Request_Client_External::$client = 'Request_Client_HTTP';
*
*
* @package Kohana
* @category Base
* @author Kohana Team
@@ -118,4 +118,4 @@ class Kohana_Request_Client_HTTP extends Request_Client_External {
return $response;
}
} // End Kohana_Request_Client_HTTP
}

View File

@@ -104,6 +104,12 @@ class Kohana_Request_Client_Internal extends Request_Client {
}
catch (HTTP_Exception $e)
{
// Store the request context in the Exception
if ($e->request() === NULL)
{
$e->request($request);
}
// Get the response via the Exception
$response = $e->get_response();
}
@@ -125,4 +131,5 @@ class Kohana_Request_Client_Internal extends Request_Client {
// Return the response
return $response;
}
} // End Kohana_Request_Client_Internal
}

View File

@@ -1,5 +1,4 @@
<?php
defined('SYSPATH') OR die('No direct script access.');
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* @package Kohana
* @category Exceptions
@@ -7,4 +6,4 @@ defined('SYSPATH') OR die('No direct script access.');
* @copyright (c) 2009-2012 Kohana Team
* @license http://kohanaframework.org/license
*/
class Kohana_Request_Client_Recursion_Exception extends Kohana_Exception {}
class Kohana_Request_Client_Recursion_Exception extends Kohana_Exception {}

View File

@@ -3,12 +3,12 @@
* [Request_Client_External] Stream driver performs external requests using php
* sockets. To use this driver, ensure the following is completed
* before executing an external request- ideally in the application bootstrap.
*
*
* @example
*
*
* // In application bootstrap
* Request_Client_External::$client = 'Request_Client_Stream';
*
*
* @package Kohana
* @category Base
* @author Kohana Team
@@ -106,4 +106,4 @@ class Kohana_Request_Client_Stream extends Request_Client_External {
return $response;
}
} // End Kohana_Request_Client_Stream
}