From: Michael Wallner Date: Wed, 15 Feb 2006 07:44:31 +0000 (+0000) Subject: - release 0.23 X-Git-Tag: RELEASE_0_23_0~1 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=24b00d45e94aef314ccee09a090609bd8a540926;p=m6w6%2Fext-http - release 0.23 --- diff --git a/docs/functions.html b/docs/functions.html index dfe5496..cca7dc4 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -276,12 +276,12 @@ several consecutive HTTP messages.

<?php
$headers 
"content-type: text/html; charset=UTF-8\r\n".
           
"Server: Funky/1.0\r\n".
           
"Set-Cookie: foo=bar\r\n".
           
"Set-Cookie: baz=quux\r\n".
           
"Folded: works\r\n\ttoo\r\n";
print_r(http_parse_headers($headers));

Array
(
    [
Content-Type] => text/htmlchatset=UTF-8
    
[Server] => Funky/1.0
    
[Set-Cookie] => Array
        (
            [
0] => foo=bar
            
[1] => baz=quux
        
)
    [
Folded] => works
        too 

?>

- +

Parses HTTP cookies like sent in a response into a struct.

Expects a string as parameter containing the value of a Set-Cookie response header.

-

Returns an stdClass object with the cookie params as properties on success or FALSE on failure.

+

Returns an stdClass olike shown in the example on success or FALSE on failure.

Example:


-<?php
print_r
(http_parse_cookie("foo=bar; path=/"));

stdClass Object
(
    [
name] => foo
    
[value] => bar
    
[path] => /
)
?>
+<?php
print_r
(http_parse_cookie("foo=bar; bar=baz; path=/; domain=example.com; comment=; secure"0, array("comment")));

stdClass Object
(
    [
cookies] => Array
        (
            [
foo] => bar
            
[bar] => baz
        
)

    [
extras] => Array
        (
            [
comment] =>
        )

    [
flags] => 16
    
[expires] => 0
    
[path] => /
    [
domain] => example.com
)
?>

array http_get_request_headers(void)

@@ -354,7 +354,7 @@ array where the following keys will be recognized:

 - redirect:
 

The optional third parameter will be filled with some additional information
in form of an associative array, if supplied, like the following example:


-<?php
array (
    
'effective_url' => 'http://localhost',
    
'response_code' => 403,
    
'total_time' => 0.017,
    
'namelookup_time' => 0.013,
    
'connect_time' => 0.014,
    
'pretransfer_time' => 0.014,
    
'size_upload' => 0,
    
'size_download' => 202,
    
'speed_download' => 11882,
    
'speed_upload' => 0,
    
'header_size' => 145,
    
'request_size' => 62,
    
'ssl_verifyresult' => 0,
    
'filetime' => -1,
    
'content_length_download' => 202,
    
'content_length_upload' => 0,
    
'starttransfer_time' => 0.017,
    
'content_type' => 'text/html; charset=iso-8859-1',
    
'redirect_time' => 0,
    
'redirect_count' => 0,
    
'http_connectcode' => 0,
    
'httpauth_avail' => 0,
    
'proxyauth_avail' => 0,
)
?>
+<?php
array (
   
'effective_url' => 'http://www.example.com/',
   
'response_code' => 302,
   
'connect_code' => 0,
   
'filetime' => -1,
   
'total_time' => 0.212348,
   
'namelookup_time' => 0.038296,
   
'connect_time' => 0.104144,
   
'pretransfer_time' => 0.104307,
   
'starttransfer_time' => 0.212077,
   
'redirect_time' => 0,
   
'redirect_count' => 0,
   
'size_upload' => 0,
   
'size_download' => 218,
   
'speed_download' => 1026,
   
'speed_upload' => 0,
   
'header_size' => 307,
   
'request_size' => 103,
   
'ssl_verifyresult' => 0,
   
'ssl_engines' =>
   array (
     
=> 'dynamic',
     
=> 'cswift',
     
=> 'chil',
     
=> 'atalla',
     
=> 'nuron',
     
=> 'ubsec',
     
=> 'aep',
     
=> 'sureware',
     
=> '4758cca',
   ),
   
'content_length_download' => 218,
   
'content_length_upload' => 0,
   
'content_type' => 'text/html',
   
'httpauth_avail' => 0,
   
'proxyauth_avail' => 0,
   
'num_connects' => 1,
   
'os_errno' => 0,
   
'error' => '',
 )
?>

Returns the HTTP response(s) as string on success, or FALSE on failure.

@@ -781,14 +781,9 @@ If the parameter is empty or omitted all response headers will be returned.

FALSE on failure, or an associative array containing all response headers.

If redirects were allowed and several responses were received, the data
references the last received response.

-

array HttpRequest::getResponseCookie([string name])

+

array HttpRequest::getResponseCookies([int flags[, array allowed_extras]])

Get response cookie(s) after the request has been sent.

-

Accepts a string as optional parameter specifying the name of the cookie to read.
-If the parameter is empty or omitted, an associative array with all received
-cookies will be returned.

-

Returns either an associative array with the cookie's name, value and any
-additional params of the cookie matching name if requested, FALSE on failure,
-or an array containing all received cookies as arrays.

+

Returns an array of stdClass objects like http_parse_cookie would return.

If redirects were allowed and several responses were received, the data
references the last received response.

string HttpRequest::getResponseBody()

@@ -843,16 +838,13 @@ may have made to the returned object.

Returns the complete web server response, including the headers in a form of a string.

HttpMessage HttpRequest::getHistory()

Get all sent requests and received responses as an HttpMessage object.

-

If you don't want to record history at all, set the instance variable
-HttpRequest::$recordHistory to FALSE.

+

If you want to record history, set the instance variable
+HttpRequest::$recordHistory to TRUE.

Returns an HttpMessage object representing the complete request/response
history.

The object references the last received response, use HttpMessage::getParentMessage()
to access the data of previously sent requests and received responses.

-

Note that the internal history is immutable, that means that any changes
-you make the the message list won't affect a history message list newly
-created by another call to HttpRequest::getHistory().

-

Throws HttpMalformedHeaderException, HttpEncodingException.

+

Throws HttpRuntimeException.

void HttpRequest::clearHistory()

Clear the history.

HttpMessage HttpRequest::send()

@@ -975,11 +967,13 @@ to something more appropriate than "no-cache"!

static bool HttpResponse::getGzip()

Get current gzipping setting.

Returns TRUE if GZip compression is enabled, else FALSE.

-

static bool HttpResponse::setCacheControl(string control[, int max_age = 0])

+

static bool HttpResponse::setCacheControl(string control[, int max_age = 0[, bool must_revalidate = true]])

Set a custom cache-control header, usually being "private" or "public";
The max_age parameter controls how long the cache entry is valid on the client side.

Expects a string parameter containing the primary cache control setting.
-Additionally accepts an int parameter specifying the max-age setting.

+Additionally accepts an int parameter specifying the max-age setting.
+Accepts an optional third bool parameter indicating whether the cache
+must be revalidated every request.

Returns TRUE on success, or FALSE if control does not match one of
"public" , "private" or "no-cache".

Throws HttpInvalidParamException if http.only_exceptions is TRUE.

@@ -1289,7 +1283,7 @@ http.cache_log is set.

  • HttpRequest::getPutFile()
  • HttpRequest::getResponseData()
  • HttpRequest::getResponseHeader()
  • -
  • HttpRequest::getResponseCookie()
  • +
  • HttpRequest::getResponseCookies()
  • HttpRequest::getResponseBody()
  • HttpRequest::getResponseCode()
  • HttpRequest::getResponseStatus()
  • @@ -1361,7 +1355,7 @@ http.cache_log is set.

    -

    Generated at: Sat, 11 Feb 2006 15:09:37 +0100

    +

    Generated at: Wed, 15 Feb 2006 08:40:01 +0100

    diff --git a/package.xml b/package.xml index 0b386ce..d3446d5 100644 --- a/package.xml +++ b/package.xml @@ -31,19 +31,21 @@ HttpResponse 0.23.0 - 2006-02-11 + 2006-02-15 BSD, revised beta + Added 'etag' request option. + Added 'encodecookies' request option (defaults to true). + Added missing accessors for response status text to HttpMessage and HttpRequest classes. + Added HttpMessage::reverse(). ++ Added bool must_revalidate parameter to HttpResponse::setCacheControl() - Reimplemented http_parse_cookie(). - Changed HttpRequest::getResponseCookie() to HttpRequest::getResponseCookies(), compliant to http_parse_cookie(). - http_build_url() now tries to "resolve" public hostname prior falling back to localhost if neither HTTP_HOST nor SERVER_NAME is set. +- Changed HttpRequest::getHistory() to return a real property. * Fixed PHP-4.4 and PHP-5.0 build.