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

Class: HTTP_Request2_Adapter_Socket

Source Location: /HTTP_Request2-0.1.0/Request2/Adapter/Socket.php

Class Overview

HTTP_Request2_Adapter
   |
   --HTTP_Request2_Adapter_Socket

Socket-based adapter for HTTP_Request2


Author(s):

Version:

  • Release: 0.1.0

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 64]
Socket-based adapter for HTTP_Request2

This adapter uses only PHP sockets and will work on almost any PHP environment. Code is based on original HTTP_Request PEAR package.

  • Author: Alexey Borzov <avb@php.net>
  • Version: Release: 0.1.0
  • Todo: Implement HTTPS proxy support via stream_socket_enable_crypto()
  • Todo: Implement Digest authentication support
  • Todo: Support various SSL options
  • Todo: Proper read timeout handling


[ Top ]


Class Variables

$chunkLength =  0

[line 85]

Remaining length of the current chunk, when reading chunked response

Type:   integer


[ Top ]

$socket =

[line 78]

Connected socket

Type:   resource


[ Top ]

$sockets =

[line 71]

Connected sockets, needed for Keep-Alive support

Type:   array


[ Top ]



Method Detail

connect   [line 133]

bool connect( )

Connects to the remote server
  • Return: whether the connection can be persistent
  • Throws: HTTP_Request2_Exception
  • Access: protected

[ Top ]

createAuthHeader   [line 219]

string createAuthHeader( string $user, string $pass, string $scheme)

Creates the value for '[Proxy-]Authorization:' header
  • Return: header value
  • Throws: HTTP_Request2_Exception
  • Access: protected

Parameters:

string   $user   —  user name
string   $pass   —  password
string   $scheme   —  authentication scheme, one of the HTTP_Request2::AUTH_* constants

[ Top ]

disconnect   [line 201]

void disconnect( )

Disconnects from the remote server
  • Access: protected

[ Top ]

prepareHeaders   [line 239]

string prepareHeaders( )

Creates the string with the Request-Line and request headers
  • Throws: HTTP_Request2_Exception
  • Access: protected

[ Top ]

readChunked   [line 419]

string readChunked( int $bufferSize)

Reads a part of response body encoded with chunked Transfer-Encoding
  • Throws: HTTP_Request2_Exception
  • Access: protected

Parameters:

int   $bufferSize   —  buffer size to use for reading

[ Top ]

readLine   [line 400]

Available readLine( int $bufferSize)

Reads until either the end of the socket or a newline, whichever comes first

Strips the trailing newline from the returned data. Method borrowed from Net_Socket PEAR package.

  • Return: data up to the newline (not including newline)
  • Access: protected

Parameters:

int   $bufferSize   —  buffer size to use for reading

[ Top ]

readResponse   [line 330]

HTTP_Request2_Response readResponse( )

Reads the remote server's response
  • Throws: HTTP_Request2_Exception
  • Access: protected

[ Top ]

sendRequest   [line 94]

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   — 

[ Top ]

writeBody   [line 297]

void writeBody( )

Sends the request body
  • Throws: HTTP_Request2_Exception
  • Access: protected

[ Top ]


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