Class moodle_google_curlio.
More...
|
const | FORM_URLENCODED = 'application/x-www-form-urlencoded' |
|
const | NO_QUIRK_VERSION = 0x071E00 |
|
const | UNKNOWN_CODE = 0 |
|
|
| checkMustRevalidateCachedRequest ($cached, $request) |
| Check if an already cached request must be revalidated, and if so update the request with the correct ETag headers.
|
|
| needsQuirk () |
| Test for the presence of a cURL header processing bug.
|
|
| updateCachedRequest ($cached, $responseHeaders) |
| Update a cached request, using the headers from the last response.
|
|
Class moodle_google_curlio.
The initial purpose of this class is to add support for our class curl in Google_IO_Curl. It mostly entirely overrides it.
- Copyright
- 2013 Frédéric Massart
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ checkMustRevalidateCachedRequest()
Google_IO_Abstract::checkMustRevalidateCachedRequest |
( |
| $cached, |
|
|
| $request ) |
|
protectedinherited |
Check if an already cached request must be revalidated, and if so update the request with the correct ETag headers.
- Parameters
-
Google_Http_Request | $cached | A previously cached response. |
Google_Http_Request | $request | The outbound request. return bool If the cached object needs to be revalidated, false if it is still current and can be re-used. |
◆ executeRequest()
Execute an API request.
This is a copy/paste from the parent class that uses Moodle's implementation of curl. Portions have been removed or altered.
- Parameters
-
- Return values
-
Google_Http_Request | http request with the response http code, response headers and response body filled in |
- Exceptions
-
Reimplemented from Google_IO_Curl.
◆ get_option_name_from_constant()
moodle_google_curlio::get_option_name_from_constant |
( |
| $constant | ) |
|
Return the name of an option based on the constant value.
- Parameters
-
int | $constant | value of a CURL constant. |
- Return values
-
string | name of the constant if found, or throws exception. |
- Exceptions
-
- Since
- Moodle 2.5
◆ getCachedRequest()
@visible for testing.
- Parameters
-
- Return values
-
Google_Http_Request|bool | Returns the cached object or false if the operation was unsuccessful. |
◆ getHttpResponseHeaders()
Google_IO_Abstract::getHttpResponseHeaders |
( |
| $rawHeaders | ) |
|
|
inherited |
Parse out headers from raw headers.
- Parameters
-
rawHeaders | array or string |
- Return values
-
◆ getTimeout()
moodle_google_curlio::getTimeout |
( |
| ) |
|
Get the maximum request time in seconds.
Overridden to use the right option key.
- Return values
-
Reimplemented from Google_IO_Curl.
◆ makeRequest()
Execute an HTTP Request.
- Parameters
-
- Return values
-
Google_Http_Request | http request with the response http code, response headers and response body filled in |
- Exceptions
-
◆ needsQuirk()
Google_IO_Curl::needsQuirk |
( |
| ) |
|
|
protectedinherited |
Test for the presence of a cURL header processing bug.
Test for the presence of a cURL header processing bug.The cURL bug was present in versions prior to 7.30.0 and caused the header length to be miscalculated when a "Connection established" header added by some proxies was present.
- Return values
-
- Return values
-
Reimplemented from Google_IO_Abstract.
◆ parseHttpResponse()
Google_IO_Abstract::parseHttpResponse |
( |
| $respData, |
|
|
| $headerSize ) |
|
inherited |
Used by the IO lib and also the batch processing.
- Parameters
-
- Return values
-
◆ processEntityRequest()
@visible for testing Process an http request that contains an enclosed entity.
- Parameters
-
- Return values
-
◆ setCachedRequest()
@visible for testing.
Cache the response to an HTTP request if it is cacheable.
- Parameters
-
- Return values
-
bool | Returns true if the insertion was successful. Otherwise, return false. |
◆ setOptions()
moodle_google_curlio::setOptions |
( |
| $optparams | ) |
|
Set curl options.
We overwrite this method to ensure that the data passed meets the requirement of our curl implementation and so that the keys are strings, and not curl constants.
- Parameters
-
array | $optparams | Multiple options used by a cURL session. |
- Return values
-
Reimplemented from Google_IO_Curl.
◆ setTimeout()
moodle_google_curlio::setTimeout |
( |
| $timeout | ) |
|
Set the maximum request time in seconds.
Overridden to use the right option key.
- Parameters
-
Reimplemented from Google_IO_Curl.
◆ updateCachedRequest()
Google_IO_Abstract::updateCachedRequest |
( |
| $cached, |
|
|
| $responseHeaders ) |
|
protectedinherited |
Update a cached request, using the headers from the last response.
- Parameters
-
Google_Http_Request | $cached | A previously cached response. |
| mixed | Associative array of response headers from the last request. |
The documentation for this class was generated from the following file: