AC_MSG_RESULT([found: $CURL_CONFIG])
fi
+ CURL_LIBS=`$CURL_CONFIG --libs`
+
PHP_ADD_INCLUDE($CURL_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
- PHP_EVAL_LIBLINE(`$CURL_CONFIG --libs`, HTTP_SHARED_LIBADD)
+ PHP_EVAL_LIBLINE($CURL_LIBS, HTTP_SHARED_LIBADD)
AC_DEFINE([HTTP_HAVE_CURL], [1], [Have cURL support])
PHP_CHECK_LIBRARY(curl, curl_multi_strerror,
[AC_DEFINE([HAVE_CURL_MULTI_STRERROR], [1], [ ])], [ ],
[$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
)
+ PHP_CHECK_LIBRARY(curl, curl_easy_strerror,
+ [AC_DEFINE([HAVE_CURL_EASY_STRERROR], [1], [ ])], [ ],
+ [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
+ )
fi
dnl ----
PHP_ADD_INCLUDE($MHASH_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(mhash, $MHASH_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
- AC_DEFINE([HAVE_LIBMHASH], [1], [Have mhash support])
+ AC_DEFINE([HTTP_HAVE_MHASH], [1], [Have mhash support])
fi
dnl ----
http_response_object.c http_exception_object.c http_requestpool_object.c \
http_api.c http_cache_api.c http_request_api.c http_date_api.c \
http_headers_api.c http_message_api.c http_send_api.c http_url_api.c \
- http_info_api.c"
+ http_info_api.c http_request_method_api.c"
PHP_NEW_EXTENSION([http], $PHP_HTTP_SOURCES, [$ext_shared])
PHP_ADD_BUILD_DIR($ext_builddir/phpstr, 1)
PHP_SUBST([HTTP_SHARED_LIBADD])
"http_api.c http_cache_api.c http_request_pool_api.c "+
"http_request_api.c http_date_api.c http_headers_api.c "+
"http_message_api.c http_send_api.c http_url_api.c "+
- "http_info_api.c",
+ "http_info_api.c http_request_method_api.c",
null,
"/I\"" + configure_module_dirname + "/phpstr\"");
ADD_SOURCES(configure_module_dirname + "/phpstr", "phpstr.c", "http");
WARNING("mhash etag generator not enabled; libraries and headers not found");
}
- if (CHECK_LIB("libcurl.lib", "http", PHP_HTTP) &&
- CHECK_HEADER_ADD_INCLUDE("curl/easy.h", "CFLAGS_HTTP") &&
+ if (CHECK_HEADER_ADD_INCLUDE("curl/curl.h", "CFLAGS_HTTP") &&
+ CHECK_LIB("libcurl.lib", "http", PHP_HTTP) &&
CHECK_LIB("ssleay32.lib", "http", PHP_HTTP) &&
CHECK_LIB("libeay32.lib", "http", PHP_HTTP) &&
CHECK_LIB("zlib.lib", "http", PHP_HTTP) &&
CHECK_LIB("winmm.lib", "http", PHP_HTTP)) {
AC_DEFINE("HTTP_HAVE_CURL", 1, "Have CURL library");
+ AC_DEFINE("HAVE_CURL_MULTI_STRERROR", 1, "");
+ AC_DEFINE("HAVE_CURL_EASY_STRERROR", 1, "")
} else {
WARNING("curl convenience functions not enabled; libraries and headers not found");
}
#include "php_http_api.h"
#include "php_http_send_api.h"
#include "php_http_cache_api.h"
+#include "php_http_request_method_api.h"
#ifdef HTTP_HAVE_CURL
# include "php_http_request_api.h"
#endif
#ifdef ZEND_ENGINE_2
# include "php_http_util_object.h"
# include "php_http_message_object.h"
-# include "php_http_response_object.h"
+# ifndef WONKY
+# include "php_http_response_object.h"
+# endif
# ifdef HTTP_HAVE_CURL
# include "php_http_request_object.h"
# include "php_http_requestpool_object.h"
PHP_FE(http_post_fields, http_arg_pass_ref_5)
PHP_FE(http_put_file, http_arg_pass_ref_4)
PHP_FE(http_put_stream, http_arg_pass_ref_4)
+#endif
PHP_FE(http_request_method_register, NULL)
PHP_FE(http_request_method_unregister, NULL)
PHP_FE(http_request_method_exists, NULL)
PHP_FE(http_request_method_name, NULL)
-#endif
#ifndef ZEND_ENGINE_2
PHP_FE(http_build_query, NULL)
#endif
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
}
+PHP_INI_DISP(http_etag_mode_displayer)
+{
+ long value;
+
+ if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
+ value = (ini_entry->orig_value) ? atoi(ini_entry->orig_value) : HTTP_ETAG_MD5;
+ } else if (ini_entry->value) {
+ value = (ini_entry->value[0]) ? atoi(ini_entry->value) : HTTP_ETAG_MD5;
+ } else {
+ value = HTTP_ETAG_MD5;
+ }
+
+ switch (value)
+ {
+ case HTTP_ETAG_SHA1:
+ ZEND_WRITE("HTTP_ETAG_SHA1", lenof("HTTP_ETAG_SHA1"));
+ break;
+
+ case HTTP_ETAG_MD5:
+#ifndef HTTP_HAVE_MHASH
+ default:
+#endif
+ ZEND_WRITE("HTTP_ETAG_MD5", lenof("HTTP_ETAG_MD5"));
+ break;
+
+#ifdef HTTP_HAVE_MHASH
+ default:
+ {
+ const char *hash_name = mhash_get_hash_name_static(value);
+
+ if (!hash_name) {
+ ZEND_WRITE("HTTP_ETAG_MD5", lenof("HTTP_ETAG_MD5"));
+ } else {
+ ZEND_WRITE("HTTP_ETAG_MHASH|MHASH_", lenof("HTTP_ETAG_MHASH|MHASH_"));
+ ZEND_WRITE(hash_name, strlen(hash_name));
+ }
+ }
+ break;
+#endif
+ }
+}
+
#ifndef ZEND_ENGINE_2
# define OnUpdateLong OnUpdateInt
#endif
#ifdef ZEND_ENGINE_2
HTTP_PHP_INI_ENTRY("http.only_exceptions", "0", PHP_INI_ALL, OnUpdateBool, only_exceptions)
#endif
- HTTP_PHP_INI_ENTRY("http.etag_mode", "-2", PHP_INI_ALL, OnUpdateLong, etag.mode)
+ HTTP_PHP_INI_ENTRY_EX("http.etag_mode", "-2", PHP_INI_ALL, OnUpdateLong, http_etag_mode_displayer, etag.mode)
PHP_INI_END()
/* }}} */
/* {{{ PHP_MINFO_FUNCTION */
PHP_MINFO_FUNCTION(http)
{
-#ifdef ZEND_ENGINE_2
-# define HTTP_FUNC_AVAIL(CLASS) "procedural, object oriented (" CLASS ")"
-#else
-# define HTTP_FUNC_AVAIL(CLASS) "procedural"
-#endif
-
#ifdef HTTP_HAVE_CURL
# define HTTP_CURL_VERSION curl_version()
-# ifdef ZEND_ENGINE_2
-# define HTTP_CURL_AVAIL(CLASS) "procedural, object oriented (" CLASS ")"
-# else
-# define HTTP_CURL_AVAIL(CLASS) "procedural"
-# endif
#else
# define HTTP_CURL_VERSION "libcurl not available"
-# define HTTP_CURL_AVAIL(CLASS) "libcurl not available"
#endif
-#include "php_http_request_api.h"
-
php_info_print_table_start();
{
char full_version_string[1024] = {0};
php_info_print_table_row(2, "Extended HTTP support:", "enabled");
php_info_print_table_row(2, "Extension Version:", full_version_string);
+#ifdef HTTP_HAVE_CURL
+ php_info_print_table_row(2, "cURL HTTP Requests:", "enabled");
+#else
+ php_info_print_table_row(2, "cURL HTTP Requests:", "disabled");
+#endif
+#ifdef HTTP_HAVE_MHASH
+ php_info_print_table_row(2, "mhash ETag Generator:", "enabled");
+#else
+ php_info_print_table_row(2, "mhash ETag Generator:", "disabled");
+#endif
+ php_info_print_table_row(2, "Registered Classes:",
+#ifndef ZEND_ENGINE_2
+ "none"
+#else
+ "HttpUtil, "
+ "HttpMessage, "
+# ifdef HTTP_HAVE_CURL
+ "HttpRequest, "
+ "HttpRequestPool, "
+# endif
+# ifndef WONKY
+ "HttpResponse"
+# endif
+#endif
+ );
}
php_info_print_table_end();
-#ifdef HTTP_HAVE_CURL
php_info_print_table_start();
{
unsigned i;
phpstr_free(&custom_request_methods);
}
php_info_print_table_end();
-#endif
-
- php_info_print_table_start();
- {
- php_info_print_table_header(2, "Functionality", "Availability");
- php_info_print_table_row(2, "Miscellaneous Utilities:", HTTP_FUNC_AVAIL("HttpUtil, HttpMessage"));
- php_info_print_table_row(2, "Extended HTTP Responses:", HTTP_FUNC_AVAIL("HttpResponse"));
- php_info_print_table_row(2, "Extended HTTP Requests:", HTTP_CURL_AVAIL("HttpRequest, HttpRequestPool"));
- }
- php_info_print_table_end();
DISPLAY_INI_ENTRIES();
}
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\http_request_method_api.c\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\http_functions.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\php_http_request_method_api.h\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\php_http_cache_api.h\r
# End Source File\r
# Begin Source File\r
#include "php_http_send_api.h"
#include "php_http_date_api.h"
-#ifdef HAVE_LIBMHASH
+#ifdef HTTP_HAVE_MHASH
# include <mhash.h>
#endif
#include "php_http_api.h"
#include "php_http_request_api.h"
#include "php_http_cache_api.h"
+#include "php_http_request_method_api.h"
#include "php_http_request_api.h"
#include "php_http_date_api.h"
#include "php_http_headers_api.h"
#include "php_http_std_defs.h"
#include "php_http_api.h"
#include "php_http_request_api.h"
+#include "php_http_request_method_api.h"
#include "php_http_url_api.h"
#ifdef ZEND_ENGINE_2
# include "php_http_request_object.h"
ZEND_EXTERN_MODULE_GLOBALS(http);
-#if LIBCURL_VERSION_NUM < 0x070c00
+#ifndef HAVE_CURL_EASY_STRERROR
# define curl_easy_strerror(code) HTTP_G(request).error
#endif
continue; \
}
-static const char *const http_request_methods[HTTP_MAX_REQUEST_METHOD + 1];
#define http_curl_getopt(o, k, t) _http_curl_getopt_ex((o), (k), sizeof(k), (t) TSRMLS_CC)
#define http_curl_getopt_ex(o, k, l, t) _http_curl_getopt_ex((o), (k), (l), (t) TSRMLS_CC)
static inline zval *_http_curl_getopt_ex(HashTable *options, char *key, size_t keylen, int type TSRMLS_DC);
}
/* }}} */
-/* {{{ char *http_request_method_name(http_request_method) */
-PHP_HTTP_API const char *_http_request_method_name(http_request_method m TSRMLS_DC)
-{
- zval **meth;
-
- if (HTTP_STD_REQUEST_METHOD(m)) {
- return http_request_methods[m];
- }
-
- if (SUCCESS == zend_hash_index_find(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(m), (void **) &meth)) {
- return Z_STRVAL_PP(meth);
- }
-
- return http_request_methods[0];
-}
-/* }}} */
-
-/* {{{ unsigned long http_request_method_exists(zend_bool, unsigned long, char *) */
-PHP_HTTP_API unsigned long _http_request_method_exists(zend_bool by_name, unsigned long id, const char *name TSRMLS_DC)
-{
- if (by_name) {
- unsigned i;
-
- for (i = HTTP_NO_REQUEST_METHOD + 1; i < HTTP_MAX_REQUEST_METHOD; ++i) {
- if (!strcmp(name, http_request_methods[i])) {
- return i;
- }
- }
- {
- zval **data;
- char *key;
- ulong idx;
-
- FOREACH_HASH_KEYVAL(&HTTP_G(request).methods.custom, key, idx, data) {
- if (!strcmp(name, Z_STRVAL_PP(data))) {
- return idx + HTTP_MAX_REQUEST_METHOD;
- }
- }
- }
- return 0;
- } else {
- return HTTP_STD_REQUEST_METHOD(id) || zend_hash_index_exists(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(id)) ? id : 0;
- }
-}
-/* }}} */
-
-/* {{{ unsigned long http_request_method_register(char *) */
-PHP_HTTP_API unsigned long _http_request_method_register(const char *method TSRMLS_DC)
-{
- zval array;
- char *http_method;
- unsigned long meth_num = HTTP_G(request).methods.custom.nNextFreeElement + HTTP_MAX_REQUEST_METHOD;
-
- Z_ARRVAL(array) = &HTTP_G(request).methods.custom;
- add_next_index_string(&array, estrdup(method), 0);
-
- spprintf(&http_method, 0, "HTTP_%s", method);
- zend_register_long_constant(http_method, strlen(http_method) + 1, meth_num, CONST_CS, http_module_number TSRMLS_CC);
- efree(http_method);
-
- return meth_num;
-}
-/* }}} */
-
-/* {{{ STATUS http_request_method_unregister(usngigned long) */
-PHP_HTTP_API STATUS _http_request_method_unregister(unsigned long method TSRMLS_DC)
-{
- zval **zmethod;
- char *http_method;
-
- if (SUCCESS != zend_hash_index_find(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(method), (void **) &zmethod)) {
- http_error_ex(HE_NOTICE, HTTP_E_REQUEST_METHOD, "Request method with id %lu does not exist", method);
- return FAILURE;
- }
-
- spprintf(&http_method, 0, "HTTP_%s", Z_STRVAL_PP(zmethod));
-
- if ( (SUCCESS != zend_hash_index_del(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(method)))
- || (SUCCESS != zend_hash_del(EG(zend_constants), http_method, strlen(http_method) + 1))) {
- http_error_ex(HE_NOTICE, HTTP_E_REQUEST_METHOD, "Could not unregister request method: %s", http_method);
- efree(http_method);
- return FAILURE;
- }
-
- efree(http_method);
- return SUCCESS;
-}
-/* }}} */
-
-
-/* {{{ char *http_request_methods[] */
-static const char *const http_request_methods[] = {
- "UNKOWN",
- /* HTTP/1.1 */
- "GET",
- "HEAD",
- "POST",
- "PUT",
- "DELETE",
- "OPTIONS",
- "TRACE",
- "CONNECT",
- /* WebDAV - RFC 2518 */
- "PROPFIND",
- "PROPPATCH",
- "MKCOL",
- "COPY",
- "MOVE",
- "LOCK",
- "UNLOCK",
- /* WebDAV Versioning - RFC 3253 */
- "VERSION-CONTROL",
- "REPORT",
- "CHECKOUT",
- "CHECKIN",
- "UNCHECKOUT",
- "MKWORKSPACE",
- "UPDATE",
- "LABEL",
- "MERGE",
- "BASELINE-CONTROL",
- "MKACTIVITY",
- /* WebDAV Access Control - RFC 3744 */
- "ACL",
- NULL
-};
-/* }}} */
-
/* {{{ static size_t http_curl_read_callback(void *, size_t, size_t, void *) */
static size_t http_curl_read_callback(void *data, size_t len, size_t n, void *s)
{
--- /dev/null
+/*
+ +----------------------------------------------------------------------+
+ | PECL :: http |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.0 of the PHP license, that |
+ | is bundled with this package in the file LICENSE, and is available |
+ | through the world-wide-web at http://www.php.net/license/3_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 2004-2005 Michael Wallner <mike@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include "php.h"
+
+#include "php_http.h"
+#include "php_http_std_defs.h"
+#include "php_http_api.h"
+#include "php_http_request_method_api.h"
+
+#include "phpstr/phpstr.h"
+
+ZEND_EXTERN_MODULE_GLOBALS(http);
+
+/* {{{ char *http_request_methods[] */
+static const char *const http_request_methods[] = {
+ "UNKOWN",
+ /* HTTP/1.1 */
+ "GET",
+ "HEAD",
+ "POST",
+ "PUT",
+ "DELETE",
+ "OPTIONS",
+ "TRACE",
+ "CONNECT",
+ /* WebDAV - RFC 2518 */
+ "PROPFIND",
+ "PROPPATCH",
+ "MKCOL",
+ "COPY",
+ "MOVE",
+ "LOCK",
+ "UNLOCK",
+ /* WebDAV Versioning - RFC 3253 */
+ "VERSION-CONTROL",
+ "REPORT",
+ "CHECKOUT",
+ "CHECKIN",
+ "UNCHECKOUT",
+ "MKWORKSPACE",
+ "UPDATE",
+ "LABEL",
+ "MERGE",
+ "BASELINE-CONTROL",
+ "MKACTIVITY",
+ /* WebDAV Access Control - RFC 3744 */
+ "ACL",
+ NULL
+};
+/* }}} */
+
+/* {{{ char *http_request_method_name(http_request_method) */
+PHP_HTTP_API const char *_http_request_method_name(http_request_method m TSRMLS_DC)
+{
+ zval **meth;
+
+ if (HTTP_STD_REQUEST_METHOD(m)) {
+ return http_request_methods[m];
+ }
+
+ if (SUCCESS == zend_hash_index_find(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(m), (void **) &meth)) {
+ return Z_STRVAL_PP(meth);
+ }
+
+ return http_request_methods[0];
+}
+/* }}} */
+
+/* {{{ unsigned long http_request_method_exists(zend_bool, unsigned long, char *) */
+PHP_HTTP_API unsigned long _http_request_method_exists(zend_bool by_name, unsigned long id, const char *name TSRMLS_DC)
+{
+ if (by_name) {
+ unsigned i;
+
+ for (i = HTTP_NO_REQUEST_METHOD + 1; i < HTTP_MAX_REQUEST_METHOD; ++i) {
+ if (!strcmp(name, http_request_methods[i])) {
+ return i;
+ }
+ }
+ {
+ zval **data;
+ char *key;
+ ulong idx;
+
+ FOREACH_HASH_KEYVAL(&HTTP_G(request).methods.custom, key, idx, data) {
+ if (!strcmp(name, Z_STRVAL_PP(data))) {
+ return idx + HTTP_MAX_REQUEST_METHOD;
+ }
+ }
+ }
+ return 0;
+ } else {
+ return HTTP_STD_REQUEST_METHOD(id) || zend_hash_index_exists(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(id)) ? id : 0;
+ }
+}
+/* }}} */
+
+/* {{{ unsigned long http_request_method_register(char *) */
+PHP_HTTP_API unsigned long _http_request_method_register(const char *method TSRMLS_DC)
+{
+ zval array;
+ char *http_method;
+ unsigned long meth_num = HTTP_G(request).methods.custom.nNextFreeElement + HTTP_MAX_REQUEST_METHOD;
+
+ Z_ARRVAL(array) = &HTTP_G(request).methods.custom;
+ add_next_index_string(&array, estrdup(method), 0);
+
+ spprintf(&http_method, 0, "HTTP_%s", method);
+ zend_register_long_constant(http_method, strlen(http_method) + 1, meth_num, CONST_CS, http_module_number TSRMLS_CC);
+ efree(http_method);
+
+ return meth_num;
+}
+/* }}} */
+
+/* {{{ STATUS http_request_method_unregister(usngigned long) */
+PHP_HTTP_API STATUS _http_request_method_unregister(unsigned long method TSRMLS_DC)
+{
+ zval **zmethod;
+ char *http_method;
+
+ if (SUCCESS != zend_hash_index_find(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(method), (void **) &zmethod)) {
+ http_error_ex(HE_NOTICE, HTTP_E_REQUEST_METHOD, "Request method with id %lu does not exist", method);
+ return FAILURE;
+ }
+
+ spprintf(&http_method, 0, "HTTP_%s", Z_STRVAL_PP(zmethod));
+
+ if ( (SUCCESS != zend_hash_index_del(&HTTP_G(request).methods.custom, HTTP_CUSTOM_REQUEST_METHOD(method)))
+ || (SUCCESS != zend_hash_del(EG(zend_constants), http_method, strlen(http_method) + 1))) {
+ http_error_ex(HE_NOTICE, HTTP_E_REQUEST_METHOD, "Could not unregister request method: %s", http_method);
+ efree(http_method);
+ return FAILURE;
+ }
+
+ efree(http_method);
+ return SUCCESS;
+}
+/* }}} */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+
ZEND_EXTERN_MODULE_GLOBALS(http);
+#ifndef HAVE_CURL_MULTI_STRERROR
+# define curl_multi_strerror(dummy) "unknown error"
+#endif
+
static void http_request_pool_freebody(http_request_body **body);
static int http_request_pool_compare_handles(void *h1, void *h2);
zend_llist contexts;
zend_llist convs;
} copies;
-# if LIBCURL_VERSION_NUM < 0x070c00
+# ifndef HAVE_CURL_EASY_STRERROR
char error[CURL_ERROR_SIZE + 1];
# endif
#endif /* HTTP_HAVE_CURL */
PHP_FUNCTION(http_post_fields);
PHP_FUNCTION(http_put_file);
PHP_FUNCTION(http_put_stream);
-/*PHP_FUNCTION(http_request)*/
+#endif /* HTTP_HAVE_CURL */
PHP_FUNCTION(http_request_method_register);
PHP_FUNCTION(http_request_method_unregister);
PHP_FUNCTION(http_request_method_exists);
PHP_FUNCTION(http_request_method_name);
-#endif /* HTTP_HAVE_CURL */
#ifndef ZEND_ENGINE_2
PHP_FUNCTION(http_build_query);
#endif /* ZEND_ENGINE_2 */
#include "php_http_api.h"
#include "php_http_send_api.h"
-#ifdef HAVE_LIBMHASH
+#ifdef HTTP_HAVE_MHASH
# include <mhash.h>
#endif
HTTP_ETAG_MHASH = 0,
} http_etag_mode;
-#ifdef HAVE_LIBMHASH
+#ifdef HTTP_HAVE_MHASH
static void *http_etag_alloc_mhash_digest(size_t size)
{
return emalloc(size);
break;
case HTTP_ETAG_MD5:
-#ifndef HAVE_LIBMHASH
+#ifndef HTTP_HAVE_MHASH
default:
#endif
PHP_MD5Init(ctx = emalloc(sizeof(PHP_MD5_CTX)));
break;
-#ifdef HAVE_LIBMHASH
+#ifdef HTTP_HAVE_MHASH
default:
if ((mode < 0) || ((ulong)mode > mhash_count()) || (!(ctx = mhash_init(mode)))) {
http_error_ex(HE_ERROR, HTTP_E_RUNTIME, "Invalid ETag mode: %ld", mode);
break;
case HTTP_ETAG_MD5:
-#ifndef HAVE_LIBMHASH
+#ifndef HTTP_HAVE_MHASH
default:
#endif
PHP_MD5Final(digest, ctx);
efree(ctx);
break;
-#ifdef HAVE_LIBMHASH
+#ifdef HTTP_HAVE_MHASH
default:
{
unsigned char *mhash_digest = mhash_end_m(ctx, http_etag_alloc_mhash_digest);
break;
case HTTP_ETAG_MD5:
-#ifndef HAVE_LIBMHASH
+#ifndef HTTP_HAVE_MHASH
default:
#endif
PHP_MD5Update(ctx, (const unsigned char *) data_ptr, data_len);
break;
-#ifdef HAVE_LIBMHASH
+#ifdef HTTP_HAVE_MHASH
default:
mhash(ctx, data_ptr, data_len);
break;
#ifdef HTTP_HAVE_CURL
#include "php_http_std_defs.h"
+#include "php_http_request_method_api.h"
+
#include "phpstr/phpstr.h"
#ifdef PHP_WIN32
#include <curl/curl.h>
-typedef enum {
- HTTP_NO_REQUEST_METHOD = 0,
- /* HTTP/1.1 */
- HTTP_GET = 1,
- HTTP_HEAD = 2,
- HTTP_POST = 3,
- HTTP_PUT = 4,
- HTTP_DELETE = 5,
- HTTP_OPTIONS = 6,
- HTTP_TRACE = 7,
- HTTP_CONNECT = 8,
- /* WebDAV - RFC 2518 */
- HTTP_PROPFIND = 9,
- HTTP_PROPPATCH = 10,
- HTTP_MKCOL = 11,
- HTTP_COPY = 12,
- HTTP_MOVE = 13,
- HTTP_LOCK = 14,
- HTTP_UNLOCK = 15,
- /* WebDAV Versioning - RFC 3253 */
- HTTP_VERSION_CONTROL = 16,
- HTTP_REPORT = 17,
- HTTP_CHECKOUT = 18,
- HTTP_CHECKIN = 19,
- HTTP_UNCHECKOUT = 20,
- HTTP_MKWORKSPACE = 21,
- HTTP_UPDATE = 22,
- HTTP_LABEL = 23,
- HTTP_MERGE = 24,
- HTTP_BASELINE_CONTROL = 25,
- HTTP_MKACTIVITY = 26,
- /* WebDAV Access Control - RFC 3744 */
- HTTP_ACL = 27,
- HTTP_MAX_REQUEST_METHOD = 28
-} http_request_method;
-
-#define HTTP_STD_REQUEST_METHOD(m) ((m > HTTP_NO_REQUEST_METHOD) && (m < HTTP_MAX_REQUEST_METHOD))
-#define HTTP_CUSTOM_REQUEST_METHOD(m) (m - HTTP_MAX_REQUEST_METHOD)
-
#define HTTP_REQUEST_BODY_CSTRING 1
#define HTTP_REQUEST_BODY_CURLPOST 2
#define HTTP_REQUEST_BODY_UPLOADFILE 3
#define http_request_conv(ch, rs, rq) _http_request_conv((ch), (rs), (rq) TSRMLS_CC)
extern void _http_request_conv(CURL *ch, phpstr* response, phpstr *request TSRMLS_DC);
-#define http_request_method_name(m) _http_request_method_name((m) TSRMLS_CC)
-PHP_HTTP_API const char *_http_request_method_name(http_request_method m TSRMLS_DC);
-
-#define http_request_method_exists(u, l, c) _http_request_method_exists((u), (l), (c) TSRMLS_CC)
-PHP_HTTP_API unsigned long _http_request_method_exists(zend_bool by_name, unsigned long id, const char *name TSRMLS_DC);
-
-#define http_request_method_register(m) _http_request_method_register((m) TSRMLS_CC)
-PHP_HTTP_API unsigned long _http_request_method_register(const char *method TSRMLS_DC);
-
-#define http_request_method_unregister(mn) _http_request_method_unregister((mn) TSRMLS_CC)
-PHP_HTTP_API STATUS _http_request_method_unregister(unsigned long method TSRMLS_DC);
-
#define http_request_body_new() _http_request_body_new(TSRMLS_C)
PHP_HTTP_API http_request_body *_http_request_body_new(TSRMLS_D);
--- /dev/null
+/*
+ +----------------------------------------------------------------------+
+ | PECL :: http |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.0 of the PHP license, that |
+ | is bundled with this package in the file LICENSE, and is available |
+ | through the world-wide-web at http://www.php.net/license/3_0.txt. |
+ | If you did not receive a copy of the PHP license and are unable to |
+ | obtain it through the world-wide-web, please send a note to |
+ | license@php.net so we can mail you a copy immediately. |
+ +----------------------------------------------------------------------+
+ | Copyright (c) 2004-2005 Michael Wallner <mike@php.net> |
+ +----------------------------------------------------------------------+
+*/
+
+/* $Id$ */
+
+#ifndef PHP_HTTP_REQUEST_METHOD_API_H
+#define PHP_HTTP_REQUEST_METHOD_API_H
+
+#include "php_http_std_defs.h"
+#include "phpstr/phpstr.h"
+
+typedef enum {
+ HTTP_NO_REQUEST_METHOD = 0,
+ /* HTTP/1.1 */
+ HTTP_GET = 1,
+ HTTP_HEAD = 2,
+ HTTP_POST = 3,
+ HTTP_PUT = 4,
+ HTTP_DELETE = 5,
+ HTTP_OPTIONS = 6,
+ HTTP_TRACE = 7,
+ HTTP_CONNECT = 8,
+ /* WebDAV - RFC 2518 */
+ HTTP_PROPFIND = 9,
+ HTTP_PROPPATCH = 10,
+ HTTP_MKCOL = 11,
+ HTTP_COPY = 12,
+ HTTP_MOVE = 13,
+ HTTP_LOCK = 14,
+ HTTP_UNLOCK = 15,
+ /* WebDAV Versioning - RFC 3253 */
+ HTTP_VERSION_CONTROL = 16,
+ HTTP_REPORT = 17,
+ HTTP_CHECKOUT = 18,
+ HTTP_CHECKIN = 19,
+ HTTP_UNCHECKOUT = 20,
+ HTTP_MKWORKSPACE = 21,
+ HTTP_UPDATE = 22,
+ HTTP_LABEL = 23,
+ HTTP_MERGE = 24,
+ HTTP_BASELINE_CONTROL = 25,
+ HTTP_MKACTIVITY = 26,
+ /* WebDAV Access Control - RFC 3744 */
+ HTTP_ACL = 27,
+ HTTP_MAX_REQUEST_METHOD = 28
+} http_request_method;
+
+#define HTTP_STD_REQUEST_METHOD(m) ((m > HTTP_NO_REQUEST_METHOD) && (m < HTTP_MAX_REQUEST_METHOD))
+#define HTTP_CUSTOM_REQUEST_METHOD(m) (m - HTTP_MAX_REQUEST_METHOD)
+
+#define http_request_method_name(m) _http_request_method_name((m) TSRMLS_CC)
+PHP_HTTP_API const char *_http_request_method_name(http_request_method m TSRMLS_DC);
+
+#define http_request_method_exists(u, l, c) _http_request_method_exists((u), (l), (c) TSRMLS_CC)
+PHP_HTTP_API unsigned long _http_request_method_exists(zend_bool by_name, unsigned long id, const char *name TSRMLS_DC);
+
+#define http_request_method_register(m) _http_request_method_register((m) TSRMLS_CC)
+PHP_HTTP_API unsigned long _http_request_method_register(const char *method TSRMLS_DC);
+
+#define http_request_method_unregister(mn) _http_request_method_unregister((mn) TSRMLS_CC)
+PHP_HTTP_API STATUS _http_request_method_unregister(unsigned long method TSRMLS_DC);
+
+#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+
#define HTTP_PHP_INI_ENTRY(entry, default, scope, updater, global) \
STD_PHP_INI_ENTRY(entry, default, scope, updater, global, zend_http_globals, http_globals)
+#define HTTP_PHP_INI_ENTRY_EX(entry, default, scope, updater, displayer, global) \
+ STD_PHP_INI_ENTRY_EX(entry, default, scope, updater, global, zend_http_globals, http_globals, displayer)
/* {{{ arrays */
#define FOREACH_VAL(array, val) FOREACH_HASH_VAL(Z_ARRVAL_P(array), val)