From 0acbfc76b5a3e4122a6d06d64bd834a810806656 Mon Sep 17 00:00:00 2001
From: Michael Wallner
Date: Mon, 21 Nov 2005 16:48:27 +0000
Subject: [PATCH] - drop mhash support
---
config.m4 | 36 ++----
config.w32 | 22 ++--
docs/functions.html | 48 +++++++-
docs/http.ini | 9 +-
http.c | 97 +--------------
http.dsp | 4 +-
http_api.c | 4 -
http_cache_api.c | 52 ++------
http_functions.c | 2 -
http_response_object.c | 31 -----
package2.xml | 8 +-
php_http.h | 2 +-
php_http_api.h | 1 -
php_http_cache_api.h | 250 ++++++++++-----------------------------
tests/etag_mode_001.phpt | 2 +-
tests/etag_mode_002.phpt | 2 +-
tests/etag_mode_003.phpt | 2 +-
tests/etag_mode_004.phpt | 9 +-
tests/etag_mode_005.phpt | 24 ----
tests/etag_mode_011.phpt | 2 +-
tests/etag_mode_012.phpt | 3 +-
tests/etag_mode_013.phpt | 2 +-
tests/etag_mode_014.phpt | 9 +-
tests/etag_mode_015.phpt | 22 ----
tests/etag_mode_031.phpt | 2 +-
tests/etag_mode_032.phpt | 2 +-
tests/etag_mode_033.phpt | 2 +-
tests/etag_mode_034.phpt | 11 +-
tests/etag_mode_035.phpt | 24 ----
tests/etag_mode_041.phpt | 2 +-
tests/etag_mode_042.phpt | 3 +-
tests/etag_mode_043.phpt | 2 +-
tests/etag_mode_044.phpt | 9 +-
tests/etag_mode_045.phpt | 22 ----
tests/etag_mode_crc.phpt | 40 -------
35 files changed, 169 insertions(+), 593 deletions(-)
delete mode 100644 tests/etag_mode_005.phpt
delete mode 100644 tests/etag_mode_015.phpt
delete mode 100644 tests/etag_mode_035.phpt
delete mode 100644 tests/etag_mode_045.phpt
delete mode 100644 tests/etag_mode_crc.phpt
diff --git a/config.m4 b/config.m4
index 9b6176f..1e8eff1 100644
--- a/config.m4
+++ b/config.m4
@@ -7,9 +7,6 @@ PHP_ARG_ENABLE([http], [whether to enable extended HTTP support],
PHP_ARG_WITH([http-curl-requests], [whether to enable cURL HTTP requests],
[ --with-http-curl-requests[=CURLDIR]
With cURL HTTP request support])
-PHP_ARG_WITH([http-mhash-etags], [whether to enable mhash ETag generator],
-[ --with-http-mhash-etags[=MHASHDIR]
- With mhash ETag generator support])
PHP_ARG_WITH([http-magic-mime], [whether to enable response content type guessing],
[ --with-http-magic-mime[=MAGICDIR]
With magic mime response content type guessing])
@@ -133,31 +130,6 @@ dnl ----
)
fi
-dnl ----
-dnl MHASH
-dnl ----
- if test "$PHP_HTTP_MHASH_ETAGS" != "no"; then
-
- AC_MSG_CHECKING([for mhash.h])
- MHASH_DIR=
- for i in "$PHP_HTTP_MHASH_ETAGS" /usr/local /usr /opt; do
- if test -f "$i/include/mhash.h"; then
- MHASH_DIR=$i
- break
- fi
- done
- if test -z "$MHASH_DIR"; then
- AC_MSG_RESULT([not found])
- AC_MSG_ERROR([could not find mhash.h])
- else
- AC_MSG_RESULT([found in $MHASH_DIR])
- fi
-
- PHP_ADD_INCLUDE($MHASH_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(mhash, $MHASH_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
- AC_DEFINE([HTTP_HAVE_MHASH], [1], [Have mhash support])
- fi
-
dnl ----
dnl MAGIC
dnl ----
@@ -183,6 +155,12 @@ dnl ----
AC_DEFINE([HTTP_HAVE_MAGIC], [1], [Have magic mime support])
fi
+dnl ----
+dnl HASH
+dnl ----
+
+ dnl TODO
+
dnl ----
dnl DONE
dnl ----
@@ -206,7 +184,7 @@ dnl ----
dnl outside src dir, adds install-http target
PHP_ADD_MAKEFILE_FRAGMENT
dnl within src dir, installs http headers
- ifdef([PHP_INSTALL_HEADERS], [PHP_INSTALL_HEADERS(ext/http, $PHP_HTTP_HEADER_FILES)], [ ])
+ ifdef([PHP_INSTALL_HEADERS], [PHP_INSTALL_HEADERS(ext/http, $PHP_HTTP_HEADERS)], [ ])
AC_DEFINE([HAVE_HTTP], [1], [Have extended HTTP support])
fi
diff --git a/config.w32 b/config.w32
index af89ae7..a53455e 100644
--- a/config.w32
+++ b/config.w32
@@ -31,21 +31,19 @@ if (PHP_HTTP != "no") {
}
if (PHP_HASH != "no") {
- if (glob(configure_module_dirname +"\\..\\hash\\php_hash_sha.h").length) {
- ADD_FLAG("CFLAGS_HTTP", "/I"+ configure_module_dirname +"\\..\\hash");
- AC_DEFINE("HTTP_HAVE_HASH_EXT_INCLUDES", 1, "");
+ var f;
+ STDOUT.Write("Checking for ext/hash ... ");
+ if (glob((f = configure_module_dirname +"\\..\\hash") +"\\php_hash.h").length ||
+ glob((f = configure_module_dirname +"\\..\\..\\..\\pecl\\hash") +"\\php_hash.h").length) {
+ ADD_FLAG("CFLAGS_HTTP", "/I"+ f);
+ AC_DEFINE("HTTP_HAVE_EXT_HASH", 1, "");
+ ADD_EXTENSION_DEP("http", "hash", true);
+ STDOUT.WriteLine(condense_path(f));
+ } else {
+ STDOUT.WriteLine("");
}
}
- MHASH_LIB = PHP_DEBUG != "no" ? "libmhash-staticd.lib":"libmhash-static.lib";
- if (CHECK_HEADER_ADD_INCLUDE('mhash.h', 'CFLAGS_HTTP') &&
- (CHECK_LIB(MHASH_LIB, 'http', PHP_HTTP) ||
- CHECK_LIB('libmhash.lib', 'http', PHP_HTTP))) {
- AC_DEFINE('HTTP_HAVE_MHASH', 1 , "Have mhash library");
- } else {
- WARNING("mhash etag generator not enabled; libraries and headers not found");
- }
-
CURL_LIB = PHP_DEBUG != "no" ? "libcurld.lib":"libcurl.lib";
if (CHECK_HEADER_ADD_INCLUDE("curl/curl.h", "CFLAGS_HTTP") &&
CHECK_HEADER_ADD_INCLUDE("openssl/crypto.h", "CFLAGS_HTTP") &&
diff --git a/docs/functions.html b/docs/functions.html
index e1329bb..b815071 100644
--- a/docs/functions.html
+++ b/docs/functions.html
@@ -113,6 +113,19 @@ if none match.
<?php
$charsets = array(
'iso-8859-1', // default
'iso-8859-2',
'iso-8859-15',
'utf-8'
);
$pref = http_negotiate_charset($charsets, $result);
if (strcmp($pref, 'iso-8859-1')) {
iconv_set_encoding('internal_encoding', 'iso-8859-1');
iconv_set_encoding('output_encoding', $pref);
ob_start('ob_iconv_handler');
}
print_r($result);
?>
+string http_negotiate_ctype(array supported[, array &result])
+This function negotiates the clients preferred content type based on its
+Accept HTTP header. The qualifier is recognized and content types
+without qualifier are rated highest.
+Expects an array as parameter cotaining the supported content types as values.
+If the optional second parameter is supplied, it will be filled with an
+array containing the negotiation results.
+Returns the negotiated content type or the default content type
+(i.e. first array entry) if none match.
+Example:
+<?php
$ctypes = array('application/xhtml+xml', 'text/html');
http_send_content_type(http_negotiate_content_type($ctypes));
?>
+
+
bool http_send_status(int status)
Send HTTP status code.
Expects an HTTP status code as parameter.
@@ -384,8 +397,6 @@ all supported features that depend on external libraries.
and SSL requests can be issued
HTTP_SUPPORT_ENCODINGS: whether ext/http was linked against zlib,
and compressed HTTP responses can be decoded
- HTTP_SUPPORT_MHASHETAGS: whether ext/http was linked against libmhash,
- and ETags can be generated with the available mhash algorithms
HTTP_SUPPORT_MAGICMIME: whether ext/http was linked against libmagic,
and the HttpResponse::guessContentType() method is usable
@@ -480,6 +491,15 @@ This provides limited functionality compared to HttpRequest and HttpResponse.Accepts a bool parameter which specifies whether the returned string
should also contain any parent messages.
Returns the full message as string.
+int HttpMessage::count()
+Implements Countable.
+Returns the number of parent messages + 1.
+string HttpMessage::serialize()
+Implements Serializable.
+Returns the serialized representation of the HttpMessage.
+void HttpMessage::unserialize(string serialized)
+Implements Serializable.
+Re-constructs the HttpMessage based upon the serialized string.
http_request_object.c
HttpRequest
@@ -697,6 +717,11 @@ cycle.
references the last received response. Use HttpMessage::getParentMessage()
to access the data of previously sent requests whithin this request
cycle.
+Note that the internal request message is immutable, that means that the
+request message received through HttpRequest::getRequestMessage() will
+always look the same for the same request, regardless of any changes you
+may have made to the returned object.
+Throws HttpMalformedHeadersException, HttpEncodingException.
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
@@ -705,12 +730,18 @@ HttpRequest::$recoedHistory to FALSE.
history.
The object references the last received response, use HttpMessage::getParentMessage()
to access the data of previously sent requests and received responses.
-Throws HttpMalformedHeaderException.
+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.
void HttpRequest::clearHistory()
Clear the history.
HttpMessage HttpRequest::send()
Send the HTTP request.
Returns the received response as HttpMessage object.
+NOTE: While an exception may be thrown, the transfer could have succeeded
+at least partially, so you might want to check the return values of various
+HttpRequest::getResponse*() methods.
Throws HttpRuntimeException, HttpRequestException,
HttpMalformedHeaderException, HttpEncodingException.
GET example:
@@ -778,6 +809,9 @@ HttpRequestPoolException, HttpMalformedHeaderException.
Implements Iterator::next().
void HttpRequestPool::rewind()
Implements Iterator::rewind().
+int HttpRequestPool::count()
+Implements Countable.
+Returns the number of attached HttpRequest objects.
array HttpRequestPool::getAttachedRequests()
Get attached HttpRequest objects.
Returns an array containing all currently attached HttpRequest objects.
@@ -953,6 +987,8 @@ http.cache_log is set.
http_negotiate_charset
+http_negotiate_content_type
+
http_send_status
http_send_last_modified
@@ -1053,6 +1089,9 @@ http.cache_log is set.
HttpMessage::getParentMessage()
HttpMessage::send()
HttpMessage::toString()
+HttpMessage::count()
+HttpMessage::serialize()
+HttpMessage::unserialize()
@@ -1120,6 +1159,7 @@ http.cache_log is set.
HttpRequestPool::key()
HttpRequestPool::next()
HttpRequestPool::rewind()
+HttpRequestPool::count()
HttpRequestPool::getAttachedRequests()
HttpRequestPool::getFinishedRequests()
@@ -1161,7 +1201,7 @@ http.cache_log is set.
- Generated at: Fri, 04 Nov 2005 12:29:06 +0100
+ Generated at: Mon, 21 Nov 2005 16:56:18 +0100