[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/tests/test_tools/simpletest/ -> http.php (sommaire)

base include file for SimpleTest

Version: $Id: http.php 1397 2006-09-07 07:55:53Z wei $
Poids: 624 lignes (22 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 5 classes

SimpleRoute:: (6 méthodes):
  SimpleRoute()
  getUrl()
  _getRequestLine()
  _getHostLine()
  createConnection()
  _createSocket()

SimpleProxyRoute:: (4 méthodes):
  SimpleProxyRoute()
  _getRequestLine()
  _getHostLine()
  createConnection()

SimpleHttpRequest:: (6 méthodes):
  SimpleHttpRequest()
  fetch()
  _dispatchRequest()
  addHeaderLine()
  readCookiesFromJar()
  _createResponse()

SimpleHttpHeaders:: (13 méthodes):
  SimpleHttpHeaders()
  getHttpVersion()
  getRaw()
  getResponseCode()
  getLocation()
  isRedirect()
  isChallenge()
  getMimeType()
  getAuthentication()
  getRealm()
  writeCookiesToJar()
  _parseHeaderLine()
  _parseCookie()

SimpleHttpResponse:: (11 méthodes):
  SimpleHttpResponse()
  _parse()
  getMethod()
  getUrl()
  getRequestData()
  getSent()
  getContent()
  getHeaders()
  getNewCookies()
  _readAll()
  _isLastPacket()


Classe: SimpleRoute  - X-Ref

Creates HTTP headers for the end point of
a HTTP request.

SimpleRoute($url)   X-Ref
Sets the target URL.

param: SimpleUrl $url   URL as object.

getUrl()   X-Ref
Resource name.

return: SimpleUrl        Current url.

_getRequestLine($method)   X-Ref
Creates the first line which is the actual request.

param: string $method   HTTP request method, usually GET.
return: string          Request line content.

_getHostLine()   X-Ref
Creates the host part of the request.

return: string          Host line content.

createConnection($method, $timeout)   X-Ref
Opens a socket to the route.

param: string $method      HTTP request method, usually GET.
param: integer $timeout    Connection timeout.
return: SimpleSocket       New socket.

_createSocket($scheme, $host, $port, $timeout)   X-Ref
Factory for socket.

param: string $scheme                   Protocol to use.
param: string $host                     Hostname to connect to.
param: integer $port                    Remote port.
param: integer $timeout                 Connection timeout.
return: SimpleSocket/SimpleSecureSocket New socket.

Classe: SimpleProxyRoute  - X-Ref

Creates HTTP headers for the end point of
a HTTP request via a proxy server.

SimpleProxyRoute($url, $proxy, $username = false, $password = false)   X-Ref
Stashes the proxy address.

param: SimpleUrl $url     URL as object.
param: string $proxy      Proxy URL.
param: string $username   Username for autentication.
param: string $password   Password for autentication.

_getRequestLine($method)   X-Ref
Creates the first line which is the actual request.

param: string $method   HTTP request method, usually GET.
param: SimpleUrl $url   URL as object.
return: string          Request line content.

_getHostLine()   X-Ref
Creates the host part of the request.

param: SimpleUrl $url   URL as object.
return: string          Host line content.

createConnection($method, $timeout)   X-Ref
Opens a socket to the route.

param: string $method       HTTP request method, usually GET.
param: integer $timeout     Connection timeout.
return: SimpleSocket        New socket.

Classe: SimpleHttpRequest  - X-Ref

HTTP request for a web page. Factory for
HttpResponse object.

SimpleHttpRequest($route, $encoding)   X-Ref
Builds the socket request from the different pieces.
These include proxy information, URL, cookies, headers,
request method and choice of encoding.

param: SimpleRoute $route              Request route.
param: SimpleFormEncoding $encoding    Content to send with

fetch($timeout)   X-Ref
Dispatches the content to the route's socket.

param: integer $timeout      Connection timeout.
return: SimpleHttpResponse   A response which may only have

_dispatchRequest($socket, $encoding)   X-Ref
Sends the headers.

param: SimpleSocket $socket           Open socket.
param: string $method                 HTTP request method,
param: SimpleFormEncoding $encoding   Content to send with request.

addHeaderLine($header_line)   X-Ref
Adds a header line to the request.

param: string $header_line    Text of full header line.

readCookiesFromJar($jar, $url)   X-Ref
Reads all the relevant cookies from the
cookie jar.

param: SimpleCookieJar $jar     Jar to read
param: SimpleUrl $url           Url to use for scope.

_createResponse($socket)   X-Ref
Wraps the socket in a response parser.

param: SimpleSocket $socket   Responding socket.
return: SimpleHttpResponse    Parsed response object.

Classe: SimpleHttpHeaders  - X-Ref

Collection of header lines in the response.

SimpleHttpHeaders($headers)   X-Ref
Parses the incoming header block.

param: string $headers     Header block.

getHttpVersion()   X-Ref
Accessor for parsed HTTP protocol version.

return: integer           HTTP error code.

getRaw()   X-Ref
Accessor for raw header block.

return: string        All headers as raw string.

getResponseCode()   X-Ref
Accessor for parsed HTTP error code.

return: integer           HTTP error code.

getLocation()   X-Ref
Returns the redirected URL or false if
no redirection.

return: string      URL or false for none.

isRedirect()   X-Ref
Test to see if the response is a valid redirect.

return: boolean       True if valid redirect.

isChallenge()   X-Ref
Test to see if the response is an authentication
challenge.

return: boolean       True if challenge.

getMimeType()   X-Ref
Accessor for MIME type header information.

return: string           MIME type.

getAuthentication()   X-Ref
Accessor for authentication type.

return: string        Type.

getRealm()   X-Ref
Accessor for security realm.

return: string        Realm.

writeCookiesToJar($jar, $url)   X-Ref
Writes new cookies to the cookie jar.

param: SimpleCookieJar $jar   Jar to write to.
param: SimpleUrl $url         Host and path to write under.

_parseHeaderLine($header_line)   X-Ref
Called on each header line to accumulate the held
data within the class.

param: string $header_line        One line of header.

_parseCookie($cookie_line)   X-Ref
Parse the Set-cookie content.

param: string $cookie_line    Text after "Set-cookie:"
return: SimpleCookie          New cookie object.

Classe: SimpleHttpResponse  - X-Ref

Basic HTTP response.

SimpleHttpResponse($socket, $url, $encoding)   X-Ref
Constructor. Reads and parses the incoming
content and headers.

param: SimpleSocket $socket   Network connection to fetch
param: SimpleUrl $url         Resource name.
param: mixed $encoding        Record of content sent.

_parse($raw)   X-Ref
Splits up the headers and the rest of the content.

param: string $raw    Content to parse.

getMethod()   X-Ref
Original request method.

return: string        GET, POST or HEAD.

getUrl()   X-Ref
Resource name.

return: SimpleUrl        Current url.

getRequestData()   X-Ref
Original request data.

return: mixed              Sent content.

getSent()   X-Ref
Raw request that was sent down the wire.

return: string        Bytes actually sent.

getContent()   X-Ref
Accessor for the content after the last
header line.

return: string           All content.

getHeaders()   X-Ref
Accessor for header block. The response is the
combination of this and the content.

return: SimpleHeaders        Wrapped header block.

getNewCookies()   X-Ref
Accessor for any new cookies.

return: array       List of new cookies.

_readAll($socket)   X-Ref
Reads the whole of the socket output into a
single string.

param: SimpleSocket $socket  Unread socket.
return: string               Raw output if successful

_isLastPacket($packet)   X-Ref
Test to see if the packet from the socket is the
last one.

param: string $packet    Chunk to interpret.
return: boolean          True if empty or EOF.



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7