Http/Client/Adapter/Proxy.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Http  
Subpackage
Client_Adapter  
Version
$Id: Proxy.php 25273 2013-03-06 08:02:21Z frosch $  

\Zend_Http_Client_Adapter_Proxy

Package: Zend\Http\Client\Adapter
HTTP Proxy-supporting Zend_Http_Client adapter class, based on the default socket based adapter.

Should be used if proxy HTTP access is required. If no proxy is set, will fall back to Zend_Http_Client_Adapter_Socket behavior. Just like the default Socket adapter, this adapter does not require any special extensions installed.

Parent(s)
\Zend_Http_Client_Adapter_Socket
Children
\Zend_Gdata_HttpAdapterStreamingProxy
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedresource $_context = null
inherited
Stream context
Inherited from: \Zend_Http_Client_Adapter_Socket::$$_context
Default valuenullDetails
Type
resource
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$_context  
>VPropertyprotectedarray $config = array('ssltransport' => 'ssl', 'sslcert' => null, 'sslpassphrase' => null, 'sslusecontext' => false, 'proxy_host' => '', 'proxy_port' => 8080, 'proxy_user' => '', 'proxy_pass' => '', 'proxy_auth' => \Zend_Http_Client::AUTH_BASIC, 'persistent' => false)
Parameters array
Default valuearray('ssltransport' => 'ssl', 'sslcert' => null, 'sslpassphrase' => null, 'sslusecontext' => false, 'proxy_host' => '', 'proxy_port' => 8080, 'proxy_user' => '', 'proxy_pass' => '', 'proxy_auth' => \Zend_Http_Client::AUTH_BASIC, 'persistent' => false)Details
Type
array
>VPropertyprotectedstring $connectHandshakeRequest
Stores the last CONNECT handshake request
Details
Type
string
>VPropertyprotectedarray $connected_to = array(null, null)
inherited
What host/port are we connected to?
Inherited from: \Zend_Http_Client_Adapter_Socket::$$connected_to
Default valuearray(null, null)Details
Type
array
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$connected_to  
>VPropertyprotectedstring $method = null
inherited
Request method - will be set by write() and might be used by read()
Inherited from: \Zend_Http_Client_Adapter_Socket::$$method
Default valuenullDetails
Type
string
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$method  
>VPropertyprotectedboolean $negotiated = false
Whether HTTPS CONNECT was already negotiated with the proxy or not
Default valuefalseDetails
Type
boolean
>VPropertyprotectedresource $out_stream = null
inherited
Stream for storing output
Inherited from: \Zend_Http_Client_Adapter_Socket::$$out_stream
Default valuenullDetails
Type
resource
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$out_stream  
>VPropertyprotectedresource|null $socket = null
inherited
The socket for server connection
Inherited from: \Zend_Http_Client_Adapter_Socket::$$socket
Default valuenullDetails
Type
resource | null
Inherited_from
\Zend_Http_Client_Adapter_Socket::$$socket  

Methods

methodpublic__construct() : void
inherited

Adapter constructor, currently empty.

Inherited from: \Zend_Http_Client_Adapter_Socket::__construct()

Config is set using setConfig()

methodpublic__destruct() : void

Destructor: make sure the socket is disconnected

If we are in persistent TCP mode, will not close the connection

methodprotected_checkSocketReadTimeout() : void
inherited

Check if the socket has timed out - if so close connection and throw an exception

Inherited from: \Zend_Http_Client_Adapter_Socket::_checkSocketReadTimeout()
Throws
ExceptionDescription
\Zend_Http_Client_Adapter_Exceptionwith READ_TIMEOUT code
methodpublicclose() : void

Close the connection to the server

methodpublicconnect(string $host, int $port = 80, boolean $secure = false) : void

Connect to the remote server

Will try to connect to the proxy server. If no proxy was set, will fall back to the target server (behave like regular Socket adapter)

Parameters
NameTypeDescription
$hoststring
$portint
$secureboolean
methodprotectedconnectHandshake(string $host, integer $port = 443, string $http_ver = '1.1', array $headers = array()) : void

Preform handshaking with HTTPS proxy using CONNECT method

Parameters
NameTypeDescription
$hoststring
$portinteger
$http_verstring
$headersarray
Throws
ExceptionDescription
\Zend_Http_Client_Adapter_Exception
methodpublicgetConfig() : array
inherited

Retrieve the array of all configuration options

Inherited from: \Zend_Http_Client_Adapter_Socket::getConfig()
Returns
TypeDescription
array
methodpublicgetStreamContext() : resource
inherited

Get the stream context for the TCP connection to the server.

Inherited from: \Zend_Http_Client_Adapter_Socket::getStreamContext()

If no stream context is set, will create a default one.

Returns
TypeDescription
resource
methodpublicread() : string
inherited

Read response from server

Inherited from: \Zend_Http_Client_Adapter_Socket::read()
Returns
TypeDescription
string
methodpublicsetConfig(\Zend_Config $config = array()) : void
inherited

Set the configuration array for the adapter

Inherited from: \Zend_Http_Client_Adapter_Socket::setConfig()
Parameters
NameTypeDescription
$config\Zend_Config

| array $config

methodpublicsetOutputStream(resource $stream) : \Zend_Http_Client_Adapter_Socket
inherited

Set output stream for the response

Inherited from: \Zend_Http_Client_Adapter_Socket::setOutputStream()

This function sets output stream where the result will be stored.

Parameters
NameTypeDescription
$streamresource
Returns
TypeDescription
\Zend_Http_Client_Adapter_Socket
methodpublicsetStreamContext(mixed $context) : \Zend_Http_Client_Adapter_Socket
inherited

Set the stream context for the TCP connection to the server

Inherited from: \Zend_Http_Client_Adapter_Socket::setStreamContext()

Can accept either a pre-existing stream context resource, or an array of stream options, similar to the options array passed to the stream_context_create() PHP function. In such case a new stream context will be created using the passed options.

Parameters
NameTypeDescription
$contextmixed

Stream context or array of context options

Returns
TypeDescription
\Zend_Http_Client_Adapter_Socket
Details
Since
Zend Framework 1.9  
methodpublicwrite(string $method, \Zend_Uri_Http $uri, string $http_ver = '1.1', array $headers = array(), string $body = '') : string

Send request to the proxy server

Parameters
NameTypeDescription
$methodstring
$uri\Zend_Uri_Http
$http_verstring
$headersarray
$bodystring
Returns
TypeDescription
stringRequest as string
Throws
ExceptionDescription
\Zend_Http_Client_Adapter_Exception
Documentation was generated by phpDocumentor 2.0.0a12.