HTTP_Request2
[ class tree: HTTP_Request2 ] [ index: HTTP_Request2 ] [ all elements ]

Class: HTTP_Request2_Adapter_Curl

Source Location: /HTTP_Request2-2.2.1/HTTP/Request2/Adapter/Curl.php

Class Overview

HTTP_Request2_Adapter
   |
   --HTTP_Request2_Adapter_Curl

Adapter for HTTP_Request2 wrapping around cURL extension


Author(s):

Version:

  • Release: 2.2.1

Variables

Methods


Inherited Variables

Inherited Methods

Class: HTTP_Request2_Adapter

HTTP_Request2_Adapter::calculateRequestLength()
Calculates length of the request body, adds proper headers
HTTP_Request2_Adapter::sendRequest()
Sends request to the remote server and returns its response

Class Details

[line 36]
Adapter for HTTP_Request2 wrapping around cURL extension


[ Top ]


Class Variables

$errorMap = array(
        CURLE_UNSUPPORTED_PROTOCOL  => array('HTTP_Request2_MessageException',
                                             HTTP_Request2_Exception::NON_HTTP_REDIRECT),CURLE_COULDNT_RESOLVE_PROXY=>array('HTTP_Request2_ConnectionException'),CURLE_COULDNT_RESOLVE_HOST=>array('HTTP_Request2_ConnectionException'),CURLE_COULDNT_CONNECT=>array('HTTP_Request2_ConnectionException'),// error returned from write callback
CURLE_WRITE_ERROR=>array('HTTP_Request2_MessageException',HTTP_Request2_Exception::NON_HTTP_REDIRECT),CURLE_OPERATION_TIMEOUTED=>array('HTTP_Request2_MessageException',HTTP_Request2_Exception::TIMEOUT),CURLE_HTTP_RANGE_ERROR=>array('HTTP_Request2_MessageException'),CURLE_SSL_CONNECT_ERROR=>array('HTTP_Request2_ConnectionException'),CURLE_LIBRARY_NOT_FOUND=>array('HTTP_Request2_LogicException',HTTP_Request2_Exception::MISCONFIGURATION),CURLE_FUNCTION_NOT_FOUND=>array('HTTP_Request2_LogicException',HTTP_Request2_Exception::MISCONFIGURATION),CURLE_ABORTED_BY_CALLBACK=>array('HTTP_Request2_MessageException',HTTP_Request2_Exception::NON_HTTP_REDIRECT),CURLE_TOO_MANY_REDIRECTS=>array('HTTP_Request2_MessageException',HTTP_Request2_Exception::TOO_MANY_REDIRECTS),CURLE_SSL_PEER_CERTIFICATE=>array('HTTP_Request2_ConnectionException'),CURLE_GOT_NOTHING=>array('HTTP_Request2_MessageException'),CURLE_SSL_ENGINE_NOTFOUND=>array('HTTP_Request2_LogicException',HTTP_Request2_Exception::MISCONFIGURATION),CURLE_SSL_ENGINE_SETFAILED=>array('HTTP_Request2_LogicException',HTTP_Request2_Exception::MISCONFIGURATION),CURLE_SEND_ERROR=>array('HTTP_Request2_MessageException'),CURLE_RECV_ERROR=>array('HTTP_Request2_MessageException'),CURLE_SSL_CERTPROBLEM=>array('HTTP_Request2_LogicException',HTTP_Request2_Exception::INVALID_ARGUMENT),CURLE_SSL_CIPHER=>array('HTTP_Request2_ConnectionException'),CURLE_SSL_CACERT=>array('HTTP_Request2_ConnectionException'),CURLE_BAD_CONTENT_ENCODING=>array('HTTP_Request2_MessageException'),)

[line 65]

Mapping of CURLE_* constants to Exception subclasses and error codes
  • Access: protected

Type:   array


[ Top ]

$eventReceivedHeaders =  false

[line 117]

Whether 'receivedHeaders' event was sent to observers
  • Access: protected

Type:   boolean


[ Top ]

$eventSentHeaders =  false

[line 111]

Whether 'sentHeaders' event was sent to observers
  • Access: protected

Type:   boolean


[ Top ]

$headerMap = array(
        'accept-encoding' => CURLOPT_ENCODING,
        'cookie'          => CURLOPT_COOKIE,
        'referer'         => CURLOPT_REFERER,
        'user-agent'      => CURLOPT_USERAGENT
    )

[line 42]

Mapping of header names to cURL options
  • Access: protected

Type:   array


[ Top ]

$lastInfo =

[line 130]

Information about last transfer, as returned by curl_getinfo()
  • Access: protected

Type:   array


[ Top ]

$position =  0

[line 124]

Position within request body

Type:   integer


[ Top ]

$response =

[line 105]

Response being received
  • Access: protected



[ Top ]

$sslContextMap = array(
        'ssl_verify_peer' => CURLOPT_SSL_VERIFYPEER,
        'ssl_cafile'      => CURLOPT_CAINFO,
        'ssl_capath'      => CURLOPT_CAPATH,
        'ssl_local_cert'  => CURLOPT_SSLCERT,
        'ssl_passphrase'  => CURLOPT_SSLCERTPASSWD
    )

[line 53]

Mapping of SSL context options to cURL options
  • Access: protected

Type:   array


[ Top ]



Method Detail

callbackReadBody   [line 436]

string callbackReadBody( resource $ch, resource $fd, integer $length)

Callback function called by cURL for reading the request body
  • Return: part of the request body, up to $length bytes
  • Access: protected

Parameters:

resource   $ch   —  cURL handle
resource   $fd   —  file descriptor (not used)
integer   $length   —  maximum length of data to return

[ Top ]

callbackWriteBody   [line 550]

integer callbackWriteBody( resource $ch, string $string)

Callback function called by cURL for saving the response body

Parameters:

resource   $ch   —  cURL handle (not used)
string   $string   —  part of the response body

[ Top ]

callbackWriteHeader   [line 470]

integer callbackWriteHeader( resource $ch, string $string)

Callback function called by cURL for saving the response headers

Parameters:

resource   $ch   —  cURL handle
string   $string   —  response header (with trailing CRLF)

[ Top ]

createCurlHandle   [line 220]

resource createCurlHandle( )

Creates a new cURL handle and populates it with data from the request
  • Return: a cURL handle, as created by curl_init()
  • Throws: HTTP_Request2_NotImplementedException
  • Throws: HTTP_Request2_LogicException
  • Access: protected

[ Top ]

getInfo   [line 208]

array getInfo( )

Returns information about last transfer
  • Return: associative array as returned by curl_getinfo()
  • Access: public

[ Top ]

sendRequest   [line 161]

HTTP_Request2_Response sendRequest( HTTP_Request2 $request)

Sends request to the remote server and returns its response
  • Throws: HTTP_Request2_Exception
  • Access: public

Overrides HTTP_Request2_Adapter::sendRequest() (Sends request to the remote server and returns its response)

Parameters:

HTTP_Request2   $request   —  HTTP request message

[ Top ]

workaroundPhpBug47204   [line 400]

void workaroundPhpBug47204( resource $ch, array &$headers)

Workaround for PHP bug #47204 that prevents rewinding request body

The workaround consists of reading the entire request body into memory and setting it as CURLOPT_POSTFIELDS, so it isn't recommended for large file uploads, use Socket adapter instead.

  • Access: protected

Parameters:

resource   $ch   —  cURL handle
array   &$headers   —  Request headers

[ Top ]

wrapCurlError   [line 139]

HTTP_Request2_Exception wrapCurlError( resource $ch)

Creates a subclass of HTTP_Request2_Exception from curl error data
  • Access: protected

Parameters:

resource   $ch   —  curl handle

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:56:02 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.