-Copyright (c) 2004-2010, Michael Wallner <mike@iworks.at>.
+Copyright (c) 2004-2013, Michael Wallner <mike@iworks.at>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
--- /dev/null
+* let http_info.request.url be a php_url
+* let the message body be a simple query string unless files are added
+* revisit error handling
+
\ No newline at end of file
PHP_CHECK_FUNC(gethostname, nsl)
PHP_CHECK_FUNC(getdomainname, nsl)
PHP_CHECK_FUNC(getservbyport, nsl)
+ PHP_CHECK_FUNC(getservbyport_r, nsl)
PHP_CHECK_FUNC(getservbyname, nsl)
+ PHP_CHECK_FUNC(getservbyname_r, nsl)
dnl ----
dnl ZLIB
fi
fi
-dnl ----
-dnl SERF
-dnl ----
-dnl
-dnl if test "$PHP_HTTP_LIBSERF_DIR" = "no"; then
-dnl AC_DEFINE([PHP_HTTP_HAVE_SERF], [0], [ ])
-dnl else
-dnl AC_MSG_CHECKING([for serf-?/serf.h])
-dnl SERF_DIR=
-dnl for i in "$PHP_HTTP_LIBSERF_DIR" /usr/local /usr /opt; do
-dnl if test -f "$i/include/serf-0/serf.h"; then
-dnl SERF_DIR=$i
-dnl SERF_VER=0
-dnl break
-dnl elif test -f "$i/include/serf-1/serf.h"; then
-dnl SERF_DIR=$i
-dnl SERF_VER=1
-dnl fi
-dnl done
-
-dnl if test "x$SERF_DIR" = "x"; then
-dnl AC_MSG_RESULT([not found])
-dnl AC_DEFINE([PHP_HTTP_HAVE_SERF], [0], [ ])
-dnl else
-dnl AC_MSG_RESULT([found in $SERF_DIR])
-
-dnl PHP_ADD_INCLUDE($SERF_DIR/include/serf-$SERF_VER)
-dnl PHP_ADD_LIBRARY_WITH_PATH(serf-$SERF_VER, $SERF_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
-dnl AC_DEFINE([PHP_HTTP_HAVE_SERF], [1], [Have libserf support])
-dnl HTTP_HAVE_A_REQUEST_LIB=true
-dnl fi
-dnl fi
-dnl
-
dnl ----
dnl CURL
dnl ----
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
int http_module_number;
-static HashTable http_module_classes;
-void php_http_register_class(zend_class_entry *(*get_ce)(void))
-{
- zend_hash_next_index_insert(&http_module_classes, &get_ce, sizeof(get_ce), NULL);
-}
-static void php_http_registered_classes(php_http_buffer_t *buf, unsigned flags)
-{
- HashPosition pos;
- zend_class_entry *(**get_ce)(void);
-
- FOREACH_HASH_VAL(pos, &http_module_classes, get_ce) {
- zend_class_entry *ce = (*get_ce)();
- if ((flags && (ce->ce_flags & flags)) || (!flags && !(ce->ce_flags & 0x0fff))) {
- if (buf->used) {
- php_http_buffer_appends(buf, ", ");
- }
- php_http_buffer_append(buf, ce->name, ce->name_length);
- }
- }
- php_http_buffer_fix(buf);
-}
-
#if PHP_DEBUG && !HAVE_GCOV
void _dpf(int type, const char *data, size_t length)
{
#endif
PHP_INI_BEGIN()
- PHP_HTTP_INI_ENTRY("http.etag.mode", "crc32b", PHP_INI_ALL, OnUpdateString, env.etag_mode)
+ STD_PHP_INI_ENTRY("http.etag.mode", "crc32b", PHP_INI_ALL, OnUpdateString, env.etag_mode, zend_php_http_globals, php_http_globals)
PHP_INI_END()
PHP_MINIT_FUNCTION(http)
ZEND_INIT_MODULE_GLOBALS(php_http, php_http_globals_init_once, NULL);
REGISTER_INI_ENTRIES();
- zend_hash_init(&http_module_classes, 0, NULL, NULL, 1);
-
if (0
|| SUCCESS != PHP_MINIT_CALL(http_object)
|| SUCCESS != PHP_MINIT_CALL(http_exception)
return FAILURE;
}
- zend_hash_destroy(&http_module_classes);
-
return SUCCESS;
}
PHP_MINFO_FUNCTION(http)
{
- unsigned i;
php_http_buffer_t buf;
php_http_buffer_init(&buf);
php_info_print_table_row(3, "libevent", "disabled", "disabled");
#endif
-#if PHP_HTTP_HAVE_SERF
- {
- int v[3];
-
- serf_lib_version(&v[0], &v[1], &v[2]);
- php_http_buffer_appendf(&buf, "%d.%d.%d", v[0], v[1], v[2]);
- php_http_buffer_fix(&buf);
- php_info_print_table_row(3, "libserf", SERF_VERSION_STRING, buf.data);
- php_http_buffer_reset(&buf);
- }
-#else
- php_info_print_table_row(3, "libserf", "disabled", "disabled");
-#endif
php_info_print_table_end();
- php_info_print_table_start();
- php_info_print_table_colspan_header(2, "Registered API");
- for (i = 0; http_functions[i].fname; ++i) {
- if (buf.used) {
- php_http_buffer_appends(&buf, ", ");
- }
- php_http_buffer_appendl(&buf, http_functions[i].fname);
- }
- php_http_buffer_fix(&buf);
- php_info_print_table_row(2, "Functions", buf.data);
- php_http_buffer_reset(&buf);
- php_http_registered_classes(&buf, ZEND_ACC_INTERFACE);
- php_info_print_table_row(2, "Interfaces", buf.data);
- php_http_buffer_reset(&buf);
- php_http_registered_classes(&buf, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
- php_info_print_table_row(2, "Abstract Classes", buf.data);
- php_http_buffer_reset(&buf);
- php_http_registered_classes(&buf, 0);
- php_info_print_table_row(2, "Implemented Classes", buf.data);
- php_http_buffer_reset(&buf);
- php_http_registered_classes(&buf, ZEND_ACC_FINAL_CLASS);
- php_info_print_table_row(2, "Final Classes", buf.data);
- php_http_buffer_dtor(&buf);
-
- php_info_print_table_row(2, "Stream Filters", "http.chunked_encode, http.chunked_decode, http.inflate, http.deflate");
- php_info_print_table_end();
-
-
DISPLAY_INI_ENTRIES();
}
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#define phpext_http_ptr &http_module_entry
int http_module_number;
-void php_http_register_class(zend_class_entry *(*get_ce)(void));
#endif /* PHP_EXT_HTTP_H */
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
# ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
+# ifdef HAVE_ERRNO_H
+# include <errno.h>
+# endif
#endif
#include <ctype.h>
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
+/*
+ +--------------------------------------------------------------------+
+ | PECL :: http |
+ +--------------------------------------------------------------------+
+ | Redistribution and use in source and binary forms, with or without |
+ | modification, are permitted provided that the conditions mentioned |
+ | in the accompanying LICENSE file are met. |
+ +--------------------------------------------------------------------+
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+ +--------------------------------------------------------------------+
+*/
+
#include "php_http_api.h"
#include "php_http_client.h"
{
zval *new_hist, *old_hist = zend_read_property(php_http_client_class_entry, zclient, ZEND_STRL("history"), 0 TSRMLS_CC);
php_http_message_t *zipped = php_http_message_zip(response, request);
- zend_object_value ov = php_http_message_object_new_ex(php_http_message_get_class_entry(), zipped, NULL TSRMLS_CC);
+ zend_object_value ov = php_http_message_object_new_ex(php_http_message_class_entry, zipped, NULL TSRMLS_CC);
MAKE_STD_ZVAL(new_hist);
ZVAL_OBJVAL(new_hist, ov, 0);
*response = NULL;
MAKE_STD_ZVAL(zresponse);
- ZVAL_OBJVAL(zresponse, php_http_message_object_new_ex(php_http_client_response_get_class_entry(), msg, &msg_obj TSRMLS_CC), 0);
+ ZVAL_OBJVAL(zresponse, php_http_message_object_new_ex(php_http_client_response_class_entry, msg, &msg_obj TSRMLS_CC), 0);
MAKE_STD_ZVAL(zrequest);
ZVAL_OBJVAL(zrequest, ((php_http_message_object_t *) e->opaque)->zv, 1);
MAKE_STD_ZVAL(info);
array_init(info);
php_http_client_getopt(client, PHP_HTTP_CLIENT_OPT_TRANSFER_INFO, e->request, &Z_ARRVAL_P(info));
- zend_update_property(php_http_client_response_get_class_entry(), zresponse, ZEND_STRL("transferInfo"), info TSRMLS_CC);
+ zend_update_property(php_http_client_response_class_entry, zresponse, ZEND_STRL("transferInfo"), info TSRMLS_CC);
zval_ptr_dtor(&info);
zend_objects_store_add_ref_by_handle(msg_obj->zv.handle TSRMLS_CC);
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClient, __construct)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
char *driver_str = NULL, *persistent_handle_str = NULL;
int driver_len = 0, persistent_handle_len = 0;
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClient, enqueue)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
zval *request;
zend_fcall_info fci = empty_fcall_info;
zend_fcall_info_cache fcc = empty_fcall_info_cache;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|f", &request, php_http_client_request_get_class_entry(), &fci, &fcc)) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|f", &request, php_http_client_request_class_entry, &fci, &fcc)) {
php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_object_t *msg_obj = zend_object_store_get_object(request TSRMLS_CC);
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClient, dequeue)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
zval *request;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &request, php_http_client_request_get_class_entry())) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &request, php_http_client_request_class_entry)) {
php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_object_t *msg_obj = zend_object_store_get_object(request TSRMLS_CC);
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClient, requeue)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
zval *request;
zend_fcall_info fci = empty_fcall_info;
zend_fcall_info_cache fcc = empty_fcall_info_cache;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|f", &request, php_http_client_request_get_class_entry(), &fci, &fcc)) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|f", &request, php_http_client_request_class_entry, &fci, &fcc)) {
php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_object_t *msg_obj = zend_object_store_get_object(request TSRMLS_CC);
php_http_client_enqueue_t q = {
{
zval *zrequest = NULL;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O", &zrequest, php_http_client_request_get_class_entry())) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O", &zrequest, php_http_client_request_class_entry)) {
php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
if (!zrequest) {
{
RETVAL_FALSE;
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters_none()) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_client_exec(obj->client);
timeout_val.tv_sec = (time_t) timeout;
timeout_val.tv_usec = PHP_HTTP_USEC(timeout) % PHP_HTTP_MCROSEC;
- RETURN_SUCCESS(php_http_client_wait(obj->client, timeout > 0 ? &timeout_val : NULL));
+ RETURN_BOOL(SUCCESS == php_http_client_wait(obj->client, timeout > 0 ? &timeout_val : NULL));
}
RETURN_FALSE;
}
{
zval *request = NULL, *zprogress = NULL;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O!o!", &request, php_http_client_request_get_class_entry(), &zprogress)) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O!o!", &request, php_http_client_request_class_entry, &zprogress)) {
zval **args[3], *observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0 TSRMLS_CC);
if (Z_TYPE_P(observers) == IS_OBJECT) {
ZEND_END_ARG_INFO();
static PHP_METHOD(HttpClient, getObservers)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters_none()) {
zval *observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0 TSRMLS_CC);
RETVAL_ZVAL(observers, 1, 0);
{
zval *request;
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &request, php_http_client_request_get_class_entry())) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &request, php_http_client_request_class_entry)) {
php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_object_t *req_obj = zend_object_store_get_object(request TSRMLS_CC);
php_http_client_progress_state_t *progress;
{
zval *request;
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &request, php_http_client_request_get_class_entry())) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &request, php_http_client_request_class_entry)) {
php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_object_t *req_obj = zend_object_store_get_object(request TSRMLS_CC);
}
static zend_function_entry php_http_client_methods[] = {
- PHP_ME(HttpClient, __construct, ai_HttpClient_construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_ME(HttpClient, reset, ai_HttpClient_reset, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, enqueue, ai_HttpClient_enqueue, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, dequeue, ai_HttpClient_dequeue, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, requeue, ai_HttpClient_requeue, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, send, ai_HttpClient_send, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, once, ai_HttpClient_once, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, wait, ai_HttpClient_wait, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, getResponse, ai_HttpClient_getResponse, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, getHistory, ai_HttpClient_getHistory, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, enablePipelining, ai_HttpClient_enablePipelining, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, enableEvents, ai_HttpClient_enableEvents, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, notify, ai_HttpClient_notify, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, attach, ai_HttpClient_attach, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, detach, ai_HttpClient_detach, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, getObservers, ai_HttpClient_getObservers, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, getProgressInfo, ai_HttpClient_getProgressInfo, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, getTransferInfo, ai_HttpClient_getTransferInfo, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, setOptions, ai_HttpClient_setOptions, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, getOptions, ai_HttpClient_getOptions, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, setSslOptions, ai_HttpClient_setSslOptions, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, addSslOptions, ai_HttpClient_addSslOptions, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, getSslOptions, ai_HttpClient_getSslOptions, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, setCookies, ai_HttpClient_setCookies, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, addCookies, ai_HttpClient_addCookies, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, getCookies, ai_HttpClient_getCookies, ZEND_ACC_PUBLIC)
- PHP_ME(HttpClient, getAvailableDrivers, ai_HttpClient_getAvailableDrivers, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpClient, __construct, ai_HttpClient_construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_ME(HttpClient, reset, ai_HttpClient_reset, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, enqueue, ai_HttpClient_enqueue, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, dequeue, ai_HttpClient_dequeue, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, requeue, ai_HttpClient_requeue, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, send, ai_HttpClient_send, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, once, ai_HttpClient_once, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, wait, ai_HttpClient_wait, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, getResponse, ai_HttpClient_getResponse, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, getHistory, ai_HttpClient_getHistory, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, enablePipelining, ai_HttpClient_enablePipelining, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, enableEvents, ai_HttpClient_enableEvents, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, notify, ai_HttpClient_notify, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, attach, ai_HttpClient_attach, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, detach, ai_HttpClient_detach, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, getObservers, ai_HttpClient_getObservers, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, getProgressInfo, ai_HttpClient_getProgressInfo, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, getTransferInfo, ai_HttpClient_getTransferInfo, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, setOptions, ai_HttpClient_setOptions, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, getOptions, ai_HttpClient_getOptions, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, setSslOptions, ai_HttpClient_setSslOptions, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, addSslOptions, ai_HttpClient_addSslOptions, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, getSslOptions, ai_HttpClient_getSslOptions, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, setCookies, ai_HttpClient_setCookies, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, addCookies, ai_HttpClient_addCookies, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, getCookies, ai_HttpClient_getCookies, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClient, getAvailableDrivers, ai_HttpClient_getAvailableDrivers, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
EMPTY_FUNCTION_ENTRY
};
zend_hash_destroy(&php_http_client_drivers);
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
+ */
+/*
+ +--------------------------------------------------------------------+
+ | PECL :: http |
+ +--------------------------------------------------------------------+
+ | Redistribution and use in source and binary forms, with or without |
+ | modification, are permitted provided that the conditions mentioned |
+ | in the accompanying LICENSE file are met. |
+ +--------------------------------------------------------------------+
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+ +--------------------------------------------------------------------+
+*/
+
#ifndef PHP_HTTP_CLIENT_H
#define PHP_HTTP_CLIENT_H
#endif
} php_http_client_t;
-zend_class_entry *php_http_client_class_entry;
+PHP_HTTP_API zend_class_entry *php_http_client_class_entry;
typedef struct php_http_client_object {
zend_object zo;
PHP_MSHUTDOWN_FUNCTION(http_client);
#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
+ */
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
void php_http_client_options_set(zval *this_ptr, zval *opts TSRMLS_DC);
void php_http_client_options_get_subr(zval *this_ptr, char *key, size_t len, zval *return_value TSRMLS_DC);
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpClientRequest, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpClientRequest, method, 0)
-#define PHP_HTTP_CLIENT_REQUEST_ME(method, visibility) PHP_ME(HttpClientRequest, method, PHP_HTTP_ARGS(HttpClientRequest, method), visibility)
-#define PHP_HTTP_CLIENT_REQUEST_ALIAS(method, func) PHP_HTTP_STATIC_ME_ALIAS(method, func, PHP_HTTP_ARGS(HttpClientRequest, method))
-#define PHP_HTTP_CLIENT_REQUEST_MALIAS(me, al, vis) ZEND_FENTRY(me, ZEND_MN(HttpClientRequest_##al), PHP_HTTP_ARGS(HttpClientRequest, al), vis)
-
-PHP_HTTP_BEGIN_ARGS(__construct, 0)
- PHP_HTTP_ARG_VAL(method, 0)
- PHP_HTTP_ARG_VAL(url, 0)
- PHP_HTTP_ARG_ARR(headers, 1, 0)
- PHP_HTTP_ARG_OBJ(http\\Message\\Body, body, 1)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getContentType);
-PHP_HTTP_BEGIN_ARGS(setContentType, 1)
- PHP_HTTP_ARG_VAL(content_type, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getQuery);
-PHP_HTTP_BEGIN_ARGS(setQuery, 0)
- PHP_HTTP_ARG_VAL(query_data, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(addQuery, 1)
- PHP_HTTP_ARG_VAL(query_data, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getOptions);
-PHP_HTTP_BEGIN_ARGS(setOptions, 0)
- PHP_HTTP_ARG_ARR(options, 1, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getSslOptions);
-PHP_HTTP_BEGIN_ARGS(setSslOptions, 0)
- PHP_HTTP_ARG_ARR(ssl_options, 1, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(addSslOptions, 0)
- PHP_HTTP_ARG_ARR(ssl_options, 1, 0)
-PHP_HTTP_END_ARGS;
-
-
-static zend_class_entry *php_http_client_request_class_entry;
-
-zend_class_entry * php_http_client_request_get_class_entry(void)
-{
- return php_http_client_request_class_entry;
-}
-
-static zend_function_entry php_http_client_request_method_entry[] = {
- PHP_HTTP_CLIENT_REQUEST_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_HTTP_CLIENT_REQUEST_ME(getQuery, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_REQUEST_ME(setQuery, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_REQUEST_ME(addQuery, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_REQUEST_ME(getContentType, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_REQUEST_ME(setContentType, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_REQUEST_ME(setOptions, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_REQUEST_ME(getOptions, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_REQUEST_ME(setSslOptions, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_REQUEST_ME(getSslOptions, ZEND_ACC_PUBLIC)
- PHP_HTTP_CLIENT_REQUEST_ME(addSslOptions, ZEND_ACC_PUBLIC)
- EMPTY_FUNCTION_ENTRY
-};
-
-
-PHP_METHOD(HttpClientRequest, __construct)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, method)
+ ZEND_ARG_INFO(0, url)
+ ZEND_ARG_ARRAY_INFO(0, headers, 1)
+ ZEND_ARG_OBJ_INFO(0, body, http\\Message\\Body, 1)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, __construct)
{
char *meth_str = NULL, *url_str = NULL;
int meth_len = 0, url_len = 0;
zval *zheaders = NULL, *zbody = NULL;
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!a!O!", &meth_str, &meth_len, &url_str, &url_len, &zheaders, &zbody, php_http_message_body_get_class_entry())) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!a!O!", &meth_str, &meth_len, &url_str, &url_len, &zheaders, &zbody, php_http_message_body_class_entry)) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_body_object_t *body_obj = NULL;
if (zbody) {
body_obj = zend_object_store_get_object(zbody TSRMLS_CC);
Z_OBJ_ADDREF_P(zbody);
- obj->body = Z_OBJVAL_P(zbody);
+ obj->body->zv = Z_OBJVAL_P(zbody);
php_http_message_body_addref(body_obj->body);
}
} end_error_handling();
}
-
-PHP_METHOD(HttpClientRequest, setContentType)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest_setContentType, 0, 0, 1)
+ ZEND_ARG_INFO(0, content_type)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, setContentType)
{
char *ct_str;
int ct_len;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpClientRequest, getContentType)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest_getContentType, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, getContentType)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpClientRequest, setQuery)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest_setQuery, 0, 0, 0)
+ ZEND_ARG_INFO(0, query_data)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, setQuery)
{
zval *qdata = NULL;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpClientRequest, getQuery)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest_getQuery, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, getQuery)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
}
}
-PHP_METHOD(HttpClientRequest, addQuery)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest_addQuery, 0, 0, 1)
+ ZEND_ARG_INFO(0, query_data)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, addQuery)
{
zval *qdata;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpClientRequest, setOptions)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest_setOptions, 0, 0, 0)
+ ZEND_ARG_ARRAY_INFO(0, options, 1)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, setOptions)
{
zval *opts = NULL;
}
}
-PHP_METHOD(HttpClientRequest, getOptions)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest_getOptions, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, getOptions)
{
if (SUCCESS == zend_parse_parameters_none()) {
- RETURN_PROP(php_http_client_request_class_entry, "options");
+ zval *zoptions = zend_read_property(php_http_client_request_class_entry, getThis(), ZEND_STRL("options"), 0 TSRMLS_CC);
+ RETURN_ZVAL(zoptions, 1, 0);
}
RETURN_FALSE;
}
-PHP_METHOD(HttpClientRequest, setSslOptions)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest_setSslOptions, 0, 0, 0)
+ ZEND_ARG_ARRAY_INFO(0, ssl_options, 1)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, setSslOptions)
{
zval *opts = NULL;
}
}
-PHP_METHOD(HttpClientRequest, addSslOptions)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest_addSslOptions, 0, 0, 0)
+ ZEND_ARG_ARRAY_INFO(0, ssl_options, 1)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, addSslOptions)
{
zval *opts = NULL;
}
}
-PHP_METHOD(HttpClientRequest, getSslOptions)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientRequest_getSslOptions, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpClientRequest, getSslOptions)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_client_options_get_subr(getThis(), ZEND_STRS("ssl"), return_value TSRMLS_CC);
}
}
+static zend_function_entry php_http_client_request_methods[] = {
+ PHP_ME(HttpClientRequest, __construct, ai_HttpClientRequest___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_ME(HttpClientRequest, setContentType, ai_HttpClientRequest_setContentType, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, getContentType, ai_HttpClientRequest_getContentType, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, setQuery, ai_HttpClientRequest_setQuery, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, getQuery, ai_HttpClientRequest_getQuery, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, addQuery, ai_HttpClientRequest_addQuery, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, setOptions, ai_HttpClientRequest_setOptions, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, getOptions, ai_HttpClientRequest_getOptions, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, setSslOptions, ai_HttpClientRequest_setSslOptions, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, getSslOptions, ai_HttpClientRequest_getSslOptions, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpClientRequest, addSslOptions, ai_HttpClientRequest_addSslOptions, ZEND_ACC_PUBLIC)
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_client_request_class_entry;
+
PHP_MINIT_FUNCTION(http_client_request)
{
- PHP_HTTP_REGISTER_CLASS(http\\Client, Request, http_client_request, php_http_message_get_class_entry(), 0);
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http\\Client", "Request", php_http_client_request_methods);
+ php_http_client_request_class_entry = zend_register_internal_class_ex(&ce, php_http_message_class_entry, NULL TSRMLS_CC);
zend_declare_property_null(php_http_client_request_class_entry, ZEND_STRL("options"), ZEND_ACC_PROTECTED TSRMLS_CC);
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#ifndef PHP_HTTP_CLIENT_REQUEST_H
#define PHP_HTTP_CLIENT_REQUEST_H
-zend_class_entry *php_http_client_request_get_class_entry(void);
-
-PHP_METHOD(HttpClientRequest, __construct);
-PHP_METHOD(HttpClientRequest, setContentType);
-PHP_METHOD(HttpClientRequest, getContentType);
-PHP_METHOD(HttpClientRequest, setQuery);
-PHP_METHOD(HttpClientRequest, getQuery);
-PHP_METHOD(HttpClientRequest, addQuery);
-PHP_METHOD(HttpClientRequest, setOptions);
-PHP_METHOD(HttpClientRequest, getOptions);
-PHP_METHOD(HttpClientRequest, addSslOptions);
-PHP_METHOD(HttpClientRequest, setSslOptions);
-PHP_METHOD(HttpClientRequest, getSslOptions);
-
+PHP_HTTP_API zend_class_entry *php_http_client_request_class_entry;
PHP_MINIT_FUNCTION(http_client_request);
#endif /* PHP_HTTP_CLIENT_REQUEST_H */
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
zval *cookie;
MAKE_STD_ZVAL(cookie);
- ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_get_class_entry(), list, NULL TSRMLS_CC), 0);
+ ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_class_entry, list, NULL TSRMLS_CC), 0);
add_next_index_zval(return_value, cookie);
}
zval_ptr_dtor(&data);
zval *cookie;
MAKE_STD_ZVAL(cookie);
- ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_get_class_entry(), list, NULL TSRMLS_CC), 0);
+ ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_class_entry, list, NULL TSRMLS_CC), 0);
add_next_index_zval(return_value, cookie);
}
zval_ptr_dtor(&data);
int info_len = 0;
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &info_name, &info_len)) {
- zval **infop, *info = zend_read_property(php_http_client_response_get_class_entry(), getThis(), ZEND_STRL("transferInfo"), 0 TSRMLS_CC);
+ zval **infop, *info = zend_read_property(php_http_client_response_class_entry, getThis(), ZEND_STRL("transferInfo"), 0 TSRMLS_CC);
/* request completed? */
if (Z_TYPE_P(info) == IS_ARRAY) {
RETURN_FALSE;
}
-static zend_class_entry *php_http_client_response_class_entry;
-
-zend_class_entry *php_http_client_response_get_class_entry(void)
-{
- return php_http_client_response_class_entry;
-}
-
-static zend_function_entry php_http_client_response_method_entry[] = {
- PHP_ME(HttpClientResponse, getCookies, ai_HttpClientResponse_getCookies, ZEND_ACC_PUBLIC)
+static zend_function_entry php_http_client_response_methods[] = {
+ PHP_ME(HttpClientResponse, getCookies, ai_HttpClientResponse_getCookies, ZEND_ACC_PUBLIC)
PHP_ME(HttpClientResponse, getTransferInfo, ai_HttpClientResponse_getTransferInfo, ZEND_ACC_PUBLIC)
EMPTY_FUNCTION_ENTRY
};
+zend_class_entry *php_http_client_response_class_entry;
+
PHP_MINIT_FUNCTION(http_client_response)
{
- PHP_HTTP_REGISTER_CLASS(http\\Client, Response, http_client_response, php_http_message_get_class_entry(), 0);
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http\\Client", "Response", php_http_client_response_methods);
+ php_http_client_response_class_entry = zend_register_internal_class_ex(&ce, php_http_message_class_entry, NULL TSRMLS_CC);
return SUCCESS;
}
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#ifndef PHP_HTTP_CLIENT_RESPONSE_H
#define PHP_HTTP_CLIENT_RESPONSE_H
-zend_class_entry *php_http_client_response_get_class_entry(void);
-
+PHP_HTTP_API zend_class_entry *php_http_client_response_class_entry;
PHP_MINIT_FUNCTION(http_client_response);
#endif /* PHP_HTTP_CLIENT_RESPONSE_H */
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
*len = buf.used;
}
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpCookie, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpCookie, method, 0)
-#define PHP_HTTP_COOKIE_ME(method, visibility) PHP_ME(HttpCookie, method, PHP_HTTP_ARGS(HttpCookie, method), visibility)
-
-PHP_HTTP_BEGIN_ARGS(__construct, 0)
- PHP_HTTP_ARG_VAL(cookie_string, 0)
- PHP_HTTP_ARG_VAL(parser_flags, 0)
- PHP_HTTP_ARG_VAL(allowed_extras, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(toArray);
-PHP_HTTP_EMPTY_ARGS(getCookies);
-PHP_HTTP_EMPTY_ARGS(getExtras);
-PHP_HTTP_EMPTY_ARGS(getDomain);
-PHP_HTTP_EMPTY_ARGS(getPath);
-PHP_HTTP_EMPTY_ARGS(getExpires);
-PHP_HTTP_EMPTY_ARGS(getMaxAge);
-PHP_HTTP_EMPTY_ARGS(getFlags);
-PHP_HTTP_EMPTY_ARGS(toString);
-
-PHP_HTTP_BEGIN_ARGS(setDomain, 0)
- PHP_HTTP_ARG_VAL(value, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(setPath, 0)
- PHP_HTTP_ARG_VAL(value, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(setExpires, 0)
- PHP_HTTP_ARG_VAL(value, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(setMaxAge, 0)
- PHP_HTTP_ARG_VAL(value, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(setFlags, 0)
- PHP_HTTP_ARG_VAL(value, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setCookies, 0)
- PHP_HTTP_ARG_VAL(cookies, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(addCookies, 1)
- PHP_HTTP_ARG_VAL(cookies, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(setExtras, 0)
- PHP_HTTP_ARG_VAL(extras, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(addExtras, 1)
- PHP_HTTP_ARG_VAL(extras, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(setCookie, 1)
- PHP_HTTP_ARG_VAL(cookie_name, 0)
- PHP_HTTP_ARG_VAL(cookie_value, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(addCookie, 1)
- PHP_HTTP_ARG_VAL(cookie_name, 0)
- PHP_HTTP_ARG_VAL(cookie_value, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(getCookie, 1)
- PHP_HTTP_ARG_VAL(name, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(setExtra, 1)
- PHP_HTTP_ARG_VAL(extra_name, 0)
- PHP_HTTP_ARG_VAL(extra_value, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(addExtra, 1)
- PHP_HTTP_ARG_VAL(extra_name, 0)
- PHP_HTTP_ARG_VAL(extra_value, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(getExtra, 1)
- PHP_HTTP_ARG_VAL(name, 0)
-PHP_HTTP_END_ARGS;
-
-static zend_class_entry *php_http_cookie_class_entry;
-
-zend_class_entry *php_http_cookie_get_class_entry(void)
-{
- return php_http_cookie_class_entry;
-}
-
-static zend_function_entry php_http_cookie_method_entry[] = {
- PHP_HTTP_COOKIE_ME(__construct, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(getCookies, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(setCookies, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(addCookies, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(getCookie, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(setCookie, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(addCookie, ZEND_ACC_PUBLIC)
-
- PHP_HTTP_COOKIE_ME(getExtras, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(setExtras, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(addExtras, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(getExtra, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(setExtra, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(addExtra, ZEND_ACC_PUBLIC)
-
- PHP_HTTP_COOKIE_ME(getDomain, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(setDomain, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(getPath, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(setPath, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(getExpires, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(setExpires, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(getMaxAge, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(setMaxAge, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(getFlags, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(setFlags, ZEND_ACC_PUBLIC)
-
- PHP_HTTP_COOKIE_ME(toArray, ZEND_ACC_PUBLIC)
- PHP_HTTP_COOKIE_ME(toString, ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpCookie, __toString, toString, PHP_HTTP_ARGS(HttpCookie, toString), ZEND_ACC_PUBLIC)
- EMPTY_FUNCTION_ENTRY
-};
+
static zend_object_handlers php_http_cookie_object_handlers;
zend_object_value php_http_cookie_object_new(zend_class_entry *ce TSRMLS_DC)
zend_object_value php_http_cookie_object_new_ex(zend_class_entry *ce, php_http_cookie_list_t *list, php_http_cookie_object_t **ptr TSRMLS_DC)
{
- zend_object_value ov;
php_http_cookie_object_t *o;
o = ecalloc(sizeof(*o), 1);
*ptr = o;
}
- ov.handle = zend_objects_store_put(o, NULL, php_http_cookie_object_free, NULL TSRMLS_CC);
- ov.handlers = &php_http_cookie_object_handlers;
+ o->zv.handle = zend_objects_store_put(o, NULL, php_http_cookie_object_free, NULL TSRMLS_CC);
+ o->zv.handlers = &php_http_cookie_object_handlers;
- return ov;
+ return o->zv;
}
#define PHP_HTTP_COOKIE_OBJECT_INIT(obj) \
PHP_HTTP_COOKIE_OBJECT_INIT(old_obj);
- ov = php_http_cookie_object_new_ex(old_obj->o.ce, php_http_cookie_list_copy(old_obj->list, NULL), &new_obj TSRMLS_CC);
+ ov = php_http_cookie_object_new_ex(old_obj->zo.ce, php_http_cookie_list_copy(old_obj->list, NULL), &new_obj TSRMLS_CC);
zend_objects_clone_members((zend_object *) new_obj, ov, (zend_object *) old_obj, Z_OBJ_HANDLE_P(getThis()) TSRMLS_CC);
return ov;
efree(obj);
}
-PHP_METHOD(HttpCookie, __construct)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, cookie_string)
+ ZEND_ARG_INFO(0, parser_flags)
+ ZEND_ARG_INFO(0, allowed_extras)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, __construct)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
zval *zcookie = NULL;
long flags = 0;
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!lH", &zcookie, &flags, &allowed_extras)) {
if (zcookie) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
char **ae = NULL;
} end_error_handling();
}
-PHP_METHOD(HttpCookie, getCookies)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getCookies, 0, 0, 0)
+ZEND_END_ARG_INFO();;
+static PHP_METHOD(HttpCookie, getCookies)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpCookie, setCookies)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_setCookies, 0, 0, 0)
+ ZEND_ARG_INFO(0, cookies)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, setCookies)
{
HashTable *cookies = NULL;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, addCookies)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addCookies, 0, 0, 1)
+ ZEND_ARG_INFO(0, cookies)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, addCookies)
{
HashTable *cookies = NULL;
RETVAL_ZVAL(getThis(), 1, 0);
}
-
-PHP_METHOD(HttpCookie, getExtras)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getExtras, 0, 0, 0)
+ZEND_END_ARG_INFO();;
+static PHP_METHOD(HttpCookie, getExtras)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpCookie, setExtras)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_setExtras, 0, 0, 0)
+ ZEND_ARG_INFO(0, extras)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, setExtras)
{
HashTable *extras = NULL;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, addExtras)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addExtras, 0, 0, 1)
+ ZEND_ARG_INFO(0, extras)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, addExtras)
{
HashTable *extras = NULL;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, getCookie)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getCookie, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, getCookie)
{
char *name_str;
int name_len;
RETURN_FALSE;
}
-PHP_METHOD(HttpCookie, setCookie)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_setCookie, 0, 0, 1)
+ ZEND_ARG_INFO(0, cookie_name)
+ ZEND_ARG_INFO(0, cookie_value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, setCookie)
{
char *name_str, *value_str = NULL;
int name_len, value_len = 0;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, addCookie)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addCookie, 0, 0, 1)
+ ZEND_ARG_INFO(0, cookie_name)
+ ZEND_ARG_INFO(0, cookie_value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, addCookie)
{
char *name_str, *value_str;
int name_len, value_len;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, getExtra)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getExtra, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, getExtra)
{
char *name_str;
int name_len;
RETURN_FALSE;
}
-PHP_METHOD(HttpCookie, setExtra)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_setExtra, 0, 0, 1)
+ ZEND_ARG_INFO(0, extra_name)
+ ZEND_ARG_INFO(0, extra_value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, setExtra)
{
char *name_str, *value_str = NULL;
int name_len, value_len = 0;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, addExtra)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_addExtra, 0, 0, 1)
+ ZEND_ARG_INFO(0, extra_name)
+ ZEND_ARG_INFO(0, extra_value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, addExtra)
{
char *name_str, *value_str;
int name_len, value_len;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, getDomain)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getDomain, 0, 0, 0)
+ZEND_END_ARG_INFO();;
+static PHP_METHOD(HttpCookie, getDomain)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpCookie, setDomain)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_setDomain, 0, 0, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, setDomain)
{
char *domain_str = NULL;
int domain_len = 0;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, getPath)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getPath, 0, 0, 0)
+ZEND_END_ARG_INFO();;
+static PHP_METHOD(HttpCookie, getPath)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpCookie, setPath)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_setPath, 0, 0, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, setPath)
{
char *path_str = NULL;
int path_len = 0;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, getExpires)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getExpires, 0, 0, 0)
+ZEND_END_ARG_INFO();;
+static PHP_METHOD(HttpCookie, getExpires)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpCookie, setExpires)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_setExpires, 0, 0, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, setExpires)
{
long ts = -1;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, getMaxAge)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getMaxAge, 0, 0, 0)
+ZEND_END_ARG_INFO();;
+static PHP_METHOD(HttpCookie, getMaxAge)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpCookie, setMaxAge)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_setMaxAge, 0, 0, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, setMaxAge)
{
long ts = -1;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, getFlags)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_getFlags, 0, 0, 0)
+ZEND_END_ARG_INFO();;
+static PHP_METHOD(HttpCookie, getFlags)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpCookie, setFlags)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_setFlags, 0, 0, 0)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpCookie, setFlags)
{
long flags = 0;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpCookie, toString)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_toString, 0, 0, 0)
+ZEND_END_ARG_INFO();;
+static PHP_METHOD(HttpCookie, toString)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_EMPTY_STRING();
}
-PHP_METHOD(HttpCookie, toArray)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpCookie_toArray, 0, 0, 0)
+ZEND_END_ARG_INFO();;
+static PHP_METHOD(HttpCookie, toArray)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
}
}
+static zend_function_entry php_http_cookie_methods[] = {
+ PHP_ME(HttpCookie, __construct, ai_HttpCookie___construct, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, getCookies, ai_HttpCookie_getCookies, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, setCookies, ai_HttpCookie_setCookies, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, addCookies, ai_HttpCookie_addCookies, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, getCookie, ai_HttpCookie_getCookie, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, setCookie, ai_HttpCookie_setCookie, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, addCookie, ai_HttpCookie_addCookie, ZEND_ACC_PUBLIC)
+
+ PHP_ME(HttpCookie, getExtras, ai_HttpCookie_getExtras, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, setExtras, ai_HttpCookie_setExtras, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, addExtras, ai_HttpCookie_addExtras, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, getExtra, ai_HttpCookie_getExtra, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, setExtra, ai_HttpCookie_setExtra, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, addExtra, ai_HttpCookie_addExtra, ZEND_ACC_PUBLIC)
+
+ PHP_ME(HttpCookie, getDomain, ai_HttpCookie_getDomain, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, setDomain, ai_HttpCookie_setDomain, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, getPath, ai_HttpCookie_getPath, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, setPath, ai_HttpCookie_setPath, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, getExpires, ai_HttpCookie_getExpires, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, setExpires, ai_HttpCookie_setExpires, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, getMaxAge, ai_HttpCookie_getMaxAge, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, setMaxAge, ai_HttpCookie_setMaxAge, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, getFlags, ai_HttpCookie_getFlags, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, setFlags, ai_HttpCookie_setFlags, ZEND_ACC_PUBLIC)
+
+ PHP_ME(HttpCookie, toArray, ai_HttpCookie_toArray, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpCookie, toString, ai_HttpCookie_toString, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpCookie, __toString, toString, ai_HttpCookie_toString, ZEND_ACC_PUBLIC)
+
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_cookie_class_entry;
+
PHP_MINIT_FUNCTION(http_cookie)
{
- PHP_HTTP_REGISTER_CLASS(http, Cookie, http_cookie, php_http_object_get_class_entry(), 0);
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http", "Cookie", php_http_cookie_methods);
+ php_http_cookie_class_entry = zend_register_internal_class_ex(&ce, php_http_object_class_entry, NULL TSRMLS_CC);
php_http_cookie_class_entry->create_object = php_http_cookie_object_new;
memcpy(&php_http_cookie_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
php_http_cookie_object_handlers.clone_obj = php_http_cookie_object_clone;
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_from_struct(php_http_cookie_list_t *list, zval *strct TSRMLS_DC);
PHP_HTTP_API void php_http_cookie_list_to_struct(php_http_cookie_list_t *list, zval *strct);
-
-zend_class_entry *php_http_cookie_get_class_entry(void);
+PHP_HTTP_API zend_class_entry *php_http_cookie_class_entry;
typedef struct php_http_cookie_object {
- zend_object o;
+ zend_object zo;
+ zend_object_value zv;
php_http_cookie_list_t *list;
} php_http_cookie_object_t;
zend_object_value php_http_cookie_object_clone(zval *this_ptr TSRMLS_DC);
void php_http_cookie_object_free(void *object TSRMLS_DC);
-PHP_METHOD(HttpCookie, __construct);
-PHP_METHOD(HttpCookie, getCookies);
-PHP_METHOD(HttpCookie, setCookies);
-PHP_METHOD(HttpCookie, addCookies);
-PHP_METHOD(HttpCookie, getExtras);
-PHP_METHOD(HttpCookie, setExtras);
-PHP_METHOD(HttpCookie, addExtras);
-PHP_METHOD(HttpCookie, getCookie);
-PHP_METHOD(HttpCookie, setCookie);
-PHP_METHOD(HttpCookie, addCookie);
-PHP_METHOD(HttpCookie, getExtra);
-PHP_METHOD(HttpCookie, setExtra);
-PHP_METHOD(HttpCookie, addExtra);
-PHP_METHOD(HttpCookie, getDomain);
-PHP_METHOD(HttpCookie, setDomain);
-PHP_METHOD(HttpCookie, getPath);
-PHP_METHOD(HttpCookie, setPath);
-PHP_METHOD(HttpCookie, getExpires);
-PHP_METHOD(HttpCookie, setExpires);
-PHP_METHOD(HttpCookie, getMaxAge);
-PHP_METHOD(HttpCookie, setMaxAge);
-PHP_METHOD(HttpCookie, getFlags);
-PHP_METHOD(HttpCookie, setFlags);
-PHP_METHOD(HttpCookie, toString);
-PHP_METHOD(HttpCookie, toArray);
-
-extern PHP_MINIT_FUNCTION(http_cookie);
-
+PHP_MINIT_FUNCTION(http_cookie);
#endif
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
return &php_http_encoding_dechunk_ops;
}
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpEncodingStream, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpEncodingStream, method, 0)
-#define PHP_HTTP_ENCSTREAM_ME(method, visibility) PHP_ME(HttpEncodingStream, method, PHP_HTTP_ARGS(HttpEncodingStream, method), visibility)
-
-PHP_HTTP_BEGIN_ARGS(__construct, 0)
- PHP_HTTP_ARG_VAL(flags, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(update, 1)
- PHP_HTTP_ARG_VAL(data, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(flush);
-PHP_HTTP_EMPTY_ARGS(done);
-PHP_HTTP_EMPTY_ARGS(finish);
-
-static zend_class_entry *php_http_encoding_stream_class_entry;
-
-zend_class_entry *php_http_encoding_stream_get_class_entry(void)
-{
- return php_http_encoding_stream_class_entry;
-}
-
-static zend_function_entry php_http_encoding_stream_method_entry[] = {
- PHP_HTTP_ENCSTREAM_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_HTTP_ENCSTREAM_ME(update, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENCSTREAM_ME(flush, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENCSTREAM_ME(done, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENCSTREAM_ME(finish, ZEND_ACC_PUBLIC)
-
- EMPTY_FUNCTION_ENTRY
-};
static zend_object_handlers php_http_encoding_stream_object_handlers;
zend_object_value php_http_encoding_stream_object_new(zend_class_entry *ce TSRMLS_DC)
zend_object_value php_http_encoding_stream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s, php_http_encoding_stream_object_t **ptr TSRMLS_DC)
{
- zend_object_value ov;
php_http_encoding_stream_object_t *o;
o = ecalloc(1, sizeof(*o));
o->stream = s;
}
- ov.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_encoding_stream_object_free, NULL TSRMLS_CC);
- ov.handlers = &php_http_encoding_stream_object_handlers;
+ o->zv.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_encoding_stream_object_free, NULL TSRMLS_CC);
+ o->zv.handlers = &php_http_encoding_stream_object_handlers;
- return ov;
+ return o->zv;
}
zend_object_value php_http_encoding_stream_object_clone(zval *this_ptr TSRMLS_DC)
efree(o);
}
-PHP_METHOD(HttpEncodingStream, __construct)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEncodingStream, __construct)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
long flags = 0;
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags)) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
php_http_encoding_stream_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
if (!obj->stream) {
php_http_encoding_stream_ops_t *ops = NULL;
- if (instanceof_function(obj->zo.ce, php_http_deflate_stream_get_class_entry() TSRMLS_CC)) {
+ if (instanceof_function(obj->zo.ce, php_http_deflate_stream_class_entry TSRMLS_CC)) {
ops = &php_http_encoding_deflate_ops;
- } else if (instanceof_function(obj->zo.ce, php_http_inflate_stream_get_class_entry() TSRMLS_CC)) {
+ } else if (instanceof_function(obj->zo.ce, php_http_inflate_stream_class_entry TSRMLS_CC)) {
ops = &php_http_encoding_inflate_ops;
- } else if (instanceof_function(obj->zo.ce, php_http_dechunk_stream_get_class_entry() TSRMLS_CC)) {
+ } else if (instanceof_function(obj->zo.ce, php_http_dechunk_stream_class_entry TSRMLS_CC)) {
ops = &php_http_encoding_dechunk_ops;
}
} end_error_handling();
}
-PHP_METHOD(HttpEncodingStream, update)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream_update, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEncodingStream, update)
{
int data_len;
char *data_str;
RETURN_FALSE;
}
-PHP_METHOD(HttpEncodingStream, flush)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream_flush, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEncodingStream, flush)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_encoding_stream_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpEncodingStream, done)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream_done, 0, 0, 1)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEncodingStream, done)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_encoding_stream_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpEncodingStream, finish)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEncodingStream_finish, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEncodingStream, finish)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_encoding_stream_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-#undef PHP_HTTP_BEGIN_ARGS
-#undef PHP_HTTP_EMPTY_ARGS
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpDeflateStream, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpDeflateStream, method, 0)
-#define PHP_HTTP_DEFLATE_ME(method, visibility) PHP_ME(HttpDeflateStream, method, PHP_HTTP_ARGS(HttpDeflateStream, method), visibility)
-
-PHP_HTTP_BEGIN_ARGS(encode, 1)
- PHP_HTTP_ARG_VAL(data, 0)
- PHP_HTTP_ARG_VAL(flags, 0)
-PHP_HTTP_END_ARGS;
-
-static zend_class_entry *php_http_deflate_stream_class_entry;
-
-zend_class_entry *php_http_deflate_stream_get_class_entry(void)
-{
- return php_http_deflate_stream_class_entry;
-}
-
-static zend_function_entry php_http_deflate_stream_method_entry[] = {
- PHP_HTTP_DEFLATE_ME(encode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-
+static zend_function_entry php_http_encoding_stream_methods[] = {
+ PHP_ME(HttpEncodingStream, __construct, ai_HttpEncodingStream___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_ME(HttpEncodingStream, update, ai_HttpEncodingStream_update, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEncodingStream, flush, ai_HttpEncodingStream_flush, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEncodingStream, done, ai_HttpEncodingStream_done, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEncodingStream, finish, ai_HttpEncodingStream_finish, ZEND_ACC_PUBLIC)
EMPTY_FUNCTION_ENTRY
};
-PHP_METHOD(HttpDeflateStream, encode)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpDeflateStream_encode, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpDeflateStream, encode)
{
char *str;
int len;
RETURN_FALSE;
}
-#undef PHP_HTTP_BEGIN_ARGS
-#undef PHP_HTTP_EMPTY_ARGS
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpInflateStream, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpInflateStream, method, 0)
-#define PHP_HTTP_INFLATE_ME(method, visibility) PHP_ME(HttpInflateStream, method, PHP_HTTP_ARGS(HttpInflateStream, method), visibility)
-
-PHP_HTTP_BEGIN_ARGS(decode, 1)
- PHP_HTTP_ARG_VAL(data, 0)
-PHP_HTTP_END_ARGS;
-
-static zend_class_entry *php_http_inflate_stream_class_entry;
-
-zend_class_entry *php_http_inflate_stream_get_class_entry(void)
-{
- return php_http_inflate_stream_class_entry;
-}
-
-static zend_function_entry php_http_inflate_stream_method_entry[] = {
- PHP_HTTP_INFLATE_ME(decode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-
+static zend_function_entry php_http_deflate_stream_methods[] = {
+ PHP_ME(HttpDeflateStream, encode, ai_HttpDeflateStream_encode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
EMPTY_FUNCTION_ENTRY
};
-PHP_METHOD(HttpInflateStream, decode)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpInflateStream_decode, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpInflateStream, decode)
{
char *str;
int len;
RETURN_FALSE;
}
-#undef PHP_HTTP_BEGIN_ARGS
-#undef PHP_HTTP_EMPTY_ARGS
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpDechunkStream, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpDechunkStream, method, 0)
-#define PHP_HTTP_DECHUNK_ME(method, visibility) PHP_ME(HttpDechunkStream, method, PHP_HTTP_ARGS(HttpDechunkStream, method), visibility)
-
-PHP_HTTP_BEGIN_ARGS(decode, 1)
- PHP_HTTP_ARG_VAL(data, 0)
- PHP_HTTP_ARG_VAL(decoded_len, 1)
-PHP_HTTP_END_ARGS;
-
-static zend_class_entry *php_http_dechunk_stream_class_entry;
-
-zend_class_entry *php_http_dechunk_stream_get_class_entry(void)
-{
- return php_http_dechunk_stream_class_entry;
-}
-
-static zend_function_entry php_http_dechunk_stream_method_entry[] = {
- PHP_HTTP_DECHUNK_ME(decode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-
+static zend_function_entry php_http_inflate_stream_methods[] = {
+ PHP_ME(HttpInflateStream, decode, ai_HttpInflateStream_decode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
EMPTY_FUNCTION_ENTRY
};
-PHP_METHOD(HttpDechunkStream, decode)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpDechunkStream_decode, 0, 0, 1)
+ ZEND_ARG_INFO(0, data)
+ ZEND_ARG_INFO(1, decoded_len)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpDechunkStream, decode)
{
char *str;
int len;
RETURN_FALSE;
}
+static zend_function_entry php_http_dechunk_stream_methods[] = {
+ PHP_ME(HttpDechunkStream, decode, ai_HttpDechunkStream_decode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_encoding_stream_class_entry;
+zend_class_entry *php_http_deflate_stream_class_entry;
+zend_class_entry *php_http_inflate_stream_class_entry;
+zend_class_entry *php_http_dechunk_stream_class_entry;
+
PHP_MINIT_FUNCTION(http_encoding)
{
- PHP_HTTP_REGISTER_CLASS(http\\Encoding, Stream, http_encoding_stream, php_http_object_get_class_entry(), ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http\\Encoding", "Stream", php_http_encoding_stream_methods);
+ php_http_encoding_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_object_class_entry, NULL TSRMLS_CC);
+ php_http_encoding_stream_class_entry->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
php_http_encoding_stream_class_entry->create_object = php_http_encoding_stream_object_new;
memcpy(&php_http_encoding_stream_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
php_http_encoding_stream_object_handlers.clone_obj = php_http_encoding_stream_object_clone;
zend_declare_class_constant_long(php_http_encoding_stream_class_entry, ZEND_STRL("FLUSH_SYNC"), PHP_HTTP_ENCODING_STREAM_FLUSH_SYNC TSRMLS_CC);
zend_declare_class_constant_long(php_http_encoding_stream_class_entry, ZEND_STRL("FLUSH_FULL"), PHP_HTTP_ENCODING_STREAM_FLUSH_FULL TSRMLS_CC);
- PHP_HTTP_REGISTER_CLASS(http\\Encoding\\Stream, Deflate, http_deflate_stream, php_http_encoding_stream_class_entry, 0);
+ memset(&ce, 0, sizeof(ce));
+ INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Deflate", php_http_deflate_stream_methods);
+ php_http_deflate_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_encoding_stream_class_entry, NULL TSRMLS_CC);
zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("TYPE_GZIP"), PHP_HTTP_DEFLATE_TYPE_GZIP TSRMLS_CC);
zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("TYPE_ZLIB"), PHP_HTTP_DEFLATE_TYPE_ZLIB TSRMLS_CC);
zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_RLE"), PHP_HTTP_DEFLATE_STRATEGY_RLE TSRMLS_CC);
zend_declare_class_constant_long(php_http_deflate_stream_class_entry, ZEND_STRL("STRATEGY_FIXED"), PHP_HTTP_DEFLATE_STRATEGY_FIXED TSRMLS_CC);
- PHP_HTTP_REGISTER_CLASS(http\\Encoding\\Stream, Inflate, http_inflate_stream, php_http_encoding_stream_class_entry, 0);
- PHP_HTTP_REGISTER_CLASS(http\\Encoding\\Stream, Dechunk, http_dechunk_stream, php_http_encoding_stream_class_entry, 0);
+ memset(&ce, 0, sizeof(ce));
+ INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Inflate", php_http_inflate_stream_methods);
+ php_http_inflate_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_encoding_stream_class_entry, NULL TSRMLS_CC);
+
+ memset(&ce, 0, sizeof(ce));
+ INIT_NS_CLASS_ENTRY(ce, "http\\Encoding\\Stream", "Dechunk", php_http_dechunk_stream_methods);
+ php_http_dechunk_stream_class_entry = zend_register_internal_class_ex(&ce, php_http_encoding_stream_class_entry, NULL TSRMLS_CC);
return SUCCESS;
}
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
typedef struct php_http_encoding_stream_object {
zend_object zo;
+ zend_object_value zv;
php_http_encoding_stream_t *stream;
} php_http_encoding_stream_object_t;
-zend_class_entry *php_http_encoding_stream_get_class_entry(void);
+PHP_HTTP_API zend_class_entry *php_http_encoding_stream_class_entry;
zend_object_value php_http_encoding_stream_object_new(zend_class_entry *ce TSRMLS_DC);
zend_object_value php_http_encoding_stream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s, php_http_encoding_stream_object_t **ptr TSRMLS_DC);
zend_object_value php_http_encoding_stream_object_clone(zval *object TSRMLS_DC);
void php_http_encoding_stream_object_free(void *object TSRMLS_DC);
-zend_class_entry *php_http_deflate_stream_get_class_entry(void);
-zend_class_entry *php_http_inflate_stream_get_class_entry(void);
-zend_class_entry *php_http_dechunk_stream_get_class_entry(void);
+PHP_HTTP_API zend_class_entry *php_http_deflate_stream_class_entry;
+PHP_HTTP_API zend_class_entry *php_http_inflate_stream_class_entry;
+PHP_HTTP_API zend_class_entry *php_http_dechunk_stream_class_entry;
-PHP_METHOD(HttpEncodingStream, __construct);
-PHP_METHOD(HttpEncodingStream, update);
-PHP_METHOD(HttpEncodingStream, flush);
-PHP_METHOD(HttpEncodingStream, done);
-PHP_METHOD(HttpEncodingStream, finish);
-
-PHP_METHOD(HttpDeflateStream, encode);
-PHP_METHOD(HttpInflateStream, decode);
-PHP_METHOD(HttpDechunkStream, decode);
-
-/*
-typedef struct php_http_inflatestream_object {
- zend_object zo;
- php_http_encoding_stream_t *stream;
-} php_http_inflatestream_object_t;
-
-extern zend_class_entry *php_http_inflatestream_class_entry;
-extern zend_function_entry php_http_inflatestream_method_entry[];
-
-extern zend_object_value php_http_inflatestream_object_new(zend_class_entry *ce TSRMLS_DC);
-extern zend_object_value php_http_inflatestream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s, php_http_inflatestream_object_t **ptr TSRMLS_DC);
-extern zend_object_value php_http_inflatestream_object_clone(zval *object TSRMLS_DC);
-extern void php_http_inflatestream_object_free(void *object TSRMLS_DC);
-
-PHP_METHOD(HttpInflateStream, __construct);
-PHP_METHOD(HttpInflateStream, factory);
-PHP_METHOD(HttpInflateStream, update);
-PHP_METHOD(HttpInflateStream, flush);
-PHP_METHOD(HttpInflateStream, finish);
-*/
#endif
/*
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
}
}
-
static PHP_HTTP_STRLIST(php_http_env_response_status) =
PHP_HTTP_STRLIST_ITEM("Continue")
PHP_HTTP_STRLIST_ITEM("Switching Protocols")
return php_http_strlist_find(php_http_env_response_status, 100, code);
}
-
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpEnv, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpEnv, method, 0)
-#define PHP_HTTP_ENV_ME(method) PHP_ME(HttpEnv, method, PHP_HTTP_ARGS(HttpEnv, method), ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-
-PHP_HTTP_BEGIN_ARGS(getRequestHeader, 0)
- PHP_HTTP_ARG_VAL(header_name, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(getRequestBody, 0)
- PHP_HTTP_ARG_VAL(body_class_name, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(getResponseStatusForCode, 1)
- PHP_HTTP_ARG_VAL(code, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getResponseStatusForAllCodes);
-
-PHP_HTTP_BEGIN_ARGS(getResponseHeader, 0)
- PHP_HTTP_ARG_VAL(header_name, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getResponseCode);
-
-PHP_HTTP_BEGIN_ARGS(setResponseHeader, 1)
- PHP_HTTP_ARG_VAL(header_name, 0)
- PHP_HTTP_ARG_VAL(header_value, 0)
- PHP_HTTP_ARG_VAL(response_code, 0)
- PHP_HTTP_ARG_VAL(replace_header, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setResponseCode, 1)
- PHP_HTTP_ARG_VAL(code, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(negotiateLanguage, 1)
- PHP_HTTP_ARG_VAL(supported, 0)
- PHP_HTTP_ARG_VAL(result_array, 1)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(negotiateContentType, 1)
- PHP_HTTP_ARG_VAL(supported, 0)
- PHP_HTTP_ARG_VAL(result_array, 1)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(negotiateCharset, 1)
- PHP_HTTP_ARG_VAL(supported, 0)
- PHP_HTTP_ARG_VAL(result_array, 1)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(negotiateEncoding, 1)
- PHP_HTTP_ARG_VAL(supported, 0)
- PHP_HTTP_ARG_VAL(result_array, 1)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(negotiate, 2)
- PHP_HTTP_ARG_VAL(value, 0)
- PHP_HTTP_ARG_VAL(supported, 0)
- PHP_HTTP_ARG_VAL(primary_type_separator, 0)
- PHP_HTTP_ARG_VAL(result_array, 1)
-PHP_HTTP_END_ARGS;
-
-static zend_class_entry *php_http_env_class_entry;
-
-zend_class_entry *php_http_env_get_class_entry(void)
-{
- return php_http_env_class_entry;
-}
-
-static zend_function_entry php_http_env_method_entry[] = {
- PHP_HTTP_ENV_ME(getRequestHeader)
- PHP_HTTP_ENV_ME(getRequestBody)
-
- PHP_HTTP_ENV_ME(getResponseStatusForCode)
- PHP_HTTP_ENV_ME(getResponseStatusForAllCodes)
-
- PHP_HTTP_ENV_ME(getResponseHeader)
- PHP_HTTP_ENV_ME(getResponseCode)
- PHP_HTTP_ENV_ME(setResponseHeader)
- PHP_HTTP_ENV_ME(setResponseCode)
-
- PHP_HTTP_ENV_ME(negotiateLanguage)
- PHP_HTTP_ENV_ME(negotiateContentType)
- PHP_HTTP_ENV_ME(negotiateEncoding)
- PHP_HTTP_ENV_ME(negotiateCharset)
- PHP_HTTP_ENV_ME(negotiate)
-
- EMPTY_FUNCTION_ENTRY
-};
-
-PHP_METHOD(HttpEnv, getRequestHeader)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_getRequestHeader, 0, 0, 0)
+ ZEND_ARG_INFO(0, header_name)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, getRequestHeader)
{
char *header_name_str = NULL;
int header_name_len = 0;
RETURN_FALSE;
}
-PHP_METHOD(HttpEnv, getRequestBody)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_getRequestBody, 0, 0, 0)
+ ZEND_ARG_INFO(0, body_class_name)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, getRequestBody)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
- zend_class_entry *class_entry = php_http_message_body_get_class_entry();
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
+ zend_class_entry *class_entry = php_http_message_body_class_entry;
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &class_entry)) {
zend_object_value ov;
php_http_message_body_t *body = php_http_env_get_request_body(TSRMLS_C);
- if (SUCCESS == php_http_new(&ov, class_entry, (php_http_new_t) php_http_message_body_object_new_ex, php_http_message_body_get_class_entry(), php_http_message_body_init(&body, NULL TSRMLS_CC), NULL TSRMLS_CC)) {
+ if (SUCCESS == php_http_new(&ov, class_entry, (php_http_new_t) php_http_message_body_object_new_ex, php_http_message_body_class_entry, php_http_message_body_init(&body, NULL TSRMLS_CC), NULL TSRMLS_CC)) {
RETVAL_OBJVAL(ov, 0);
}
}
} end_error_handling();
}
-PHP_METHOD(HttpEnv, getResponseStatusForCode)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_getResponseStatusForCode, 0, 0, 1)
+ ZEND_ARG_INFO(0, code)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, getResponseStatusForCode)
{
long code;
RETURN_FALSE;
}
-PHP_METHOD(HttpEnv, getResponseStatusForAllCodes)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_getResponseStatusForAllCodes, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, getResponseStatusForAllCodes)
{
const char *s;
unsigned c;
}
}
-PHP_METHOD(HttpEnv, getResponseHeader)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_getResponseHeader, 0, 0, 0)
+ ZEND_ARG_INFO(0, header_name)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, getResponseHeader)
{
char *header_name_str = NULL;
int header_name_len = 0;
RETURN_FALSE;
}
-PHP_METHOD(HttpEnv, getResponseCode)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_getResponseCode, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, getResponseCode)
{
if (SUCCESS == zend_parse_parameters_none()) {
RETURN_LONG(php_http_env_get_response_code(TSRMLS_C));
RETURN_FALSE;
}
-PHP_METHOD(HttpEnv, setResponseHeader)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_setResponseHeader, 0, 0, 1)
+ ZEND_ARG_INFO(0, header_name)
+ ZEND_ARG_INFO(0, header_value)
+ ZEND_ARG_INFO(0, response_code)
+ ZEND_ARG_INFO(0, replace_header)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, setResponseHeader)
{
char *header_name_str;
int header_name_len;
zend_bool replace_header = 1;
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z!lb", &header_name_str, &header_name_len, &header_value, &code, &replace_header)) {
- RETURN_SUCCESS(php_http_env_set_response_header_value(code, header_name_str, header_name_len, header_value, replace_header TSRMLS_CC));
+ RETURN_BOOL(SUCCESS == php_http_env_set_response_header_value(code, header_name_str, header_name_len, header_value, replace_header TSRMLS_CC));
}
RETURN_FALSE;
}
-PHP_METHOD(HttpEnv, setResponseCode)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_setResponseCode, 0, 0, 1)
+ ZEND_ARG_INFO(0, code)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, setResponseCode)
{
long code;
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code)) {
- RETURN_SUCCESS(php_http_env_set_response_code(code TSRMLS_CC));
+ RETURN_BOOL(SUCCESS == php_http_env_set_response_code(code TSRMLS_CC));
}
RETURN_FALSE;
}
-PHP_METHOD(HttpEnv, negotiateLanguage)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_negotiateLanguage, 0, 0, 1)
+ ZEND_ARG_INFO(0, supported)
+ ZEND_ARG_INFO(1, result_array)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, negotiateLanguage)
{
HashTable *supported;
zval *rs_array = NULL;
}
}
-PHP_METHOD(HttpEnv, negotiateCharset)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_negotiateCharset, 0, 0, 1)
+ ZEND_ARG_INFO(0, supported)
+ ZEND_ARG_INFO(1, result_array)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, negotiateCharset)
{
HashTable *supported;
zval *rs_array = NULL;
}
}
-PHP_METHOD(HttpEnv, negotiateEncoding)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_negotiateEncoding, 0, 0, 1)
+ ZEND_ARG_INFO(0, supported)
+ ZEND_ARG_INFO(1, result_array)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, negotiateEncoding)
{
HashTable *supported;
zval *rs_array = NULL;
}
}
-PHP_METHOD(HttpEnv, negotiateContentType)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_negotiateContentType, 0, 0, 1)
+ ZEND_ARG_INFO(0, supported)
+ ZEND_ARG_INFO(1, result_array)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, negotiateContentType)
{
HashTable *supported;
zval *rs_array = NULL;
}
}
-PHP_METHOD(HttpEnv, negotiate)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnv_negotiate, 0, 0, 2)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_INFO(0, supported)
+ ZEND_ARG_INFO(0, primary_type_separator)
+ ZEND_ARG_INFO(1, result_array)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnv, negotiate)
{
HashTable *supported;
zval *rs_array = NULL;
}
}
+static zend_function_entry php_http_env_methods[] = {
+ PHP_ME(HttpEnv, getRequestHeader, ai_HttpEnv_getRequestHeader, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpEnv, getRequestBody, ai_HttpEnv_getRequestBody, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+
+ PHP_ME(HttpEnv, getResponseStatusForCode, ai_HttpEnv_getResponseStatusForCode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpEnv, getResponseStatusForAllCodes, ai_HttpEnv_getResponseStatusForAllCodes, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+
+ PHP_ME(HttpEnv, getResponseHeader, ai_HttpEnv_getResponseHeader, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpEnv, getResponseCode, ai_HttpEnv_getResponseCode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpEnv, setResponseHeader, ai_HttpEnv_setResponseHeader, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpEnv, setResponseCode, ai_HttpEnv_setResponseCode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+
+ PHP_ME(HttpEnv, negotiateLanguage, ai_HttpEnv_negotiateLanguage, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpEnv, negotiateContentType, ai_HttpEnv_negotiateContentType, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpEnv, negotiateEncoding, ai_HttpEnv_negotiateEncoding, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpEnv, negotiateCharset, ai_HttpEnv_negotiateCharset, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpEnv, negotiate, ai_HttpEnv_negotiate, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+
+ EMPTY_FUNCTION_ENTRY
+};
+
#ifdef PHP_HTTP_HAVE_JSON
#include "ext/json/php_json.h"
}
}
-#endif
-
-PHP_MINIT_FUNCTION(http_env)
+static void php_http_env_register_json_handler(TSRMLS_D)
{
-#ifdef PHP_HTTP_HAVE_JSON
sapi_post_entry entry = {NULL, 0, NULL, NULL};
entry.post_reader = sapi_read_standard_form_data;
entry.content_type = "application/json";
entry.content_type_len = lenof("application/json");
sapi_register_post_entry(&entry TSRMLS_CC);
+}
#endif
- PHP_HTTP_REGISTER_CLASS(http, Env, http_env, NULL, 0);
+zend_class_entry *php_http_env_class_entry;
+
+PHP_MINIT_FUNCTION(http_env)
+{
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http", "Env", php_http_env_methods);
+ php_http_env_class_entry = zend_register_internal_class_ex(&ce, php_http_object_class_entry, NULL TSRMLS_CC);
+
+#ifdef PHP_HTTP_HAVE_JSON
+ php_http_env_register_json_handler(TSRMLS_C);
+#endif
return SUCCESS;
}
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#define php_http_env_got_server_var(v) (NULL != php_http_env_get_server_var((v), strlen(v), 1 TSRMLS_CC))
PHP_HTTP_API zval *php_http_env_get_superglobal(const char *key, size_t key_len TSRMLS_DC);
-zend_class_entry *php_http_env_get_class_entry(void);
-
-PHP_METHOD(HttpEnv, getRequestHeader);
-PHP_METHOD(HttpEnv, getRequestBody);
-PHP_METHOD(HttpEnv, getResponseStatusForCode);
-PHP_METHOD(HttpEnv, getResponseStatusForAllCodes);
-PHP_METHOD(HttpEnv, getResponseHeader);
-PHP_METHOD(HttpEnv, getResponseCode);
-PHP_METHOD(HttpEnv, setResponseHeader);
-PHP_METHOD(HttpEnv, setResponseCode);
-PHP_METHOD(HttpEnv, negotiateLanguage);
-PHP_METHOD(HttpEnv, negotiateCharset);
-PHP_METHOD(HttpEnv, negotiateEncoding);
-PHP_METHOD(HttpEnv, negotiateContentType);
-PHP_METHOD(HttpEnv, negotiate);
-
+PHP_HTTP_API zend_class_entry *php_http_env_class_entry;
PHP_MINIT_FUNCTION(http_env);
PHP_RINIT_FUNCTION(http_env);
PHP_RSHUTDOWN_FUNCTION(http_env);
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#include "php_http_api.h"
-
-#undef PHP_HTTP_BEGIN_ARGS
-#undef PHP_HTTP_EMPTY_ARGS
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpEnvRequest, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpEnvRequest, method, 0)
-#define PHP_HTTP_ENV_REQUEST_ME(method, visibility) PHP_ME(HttpEnvRequest, method, PHP_HTTP_ARGS(HttpEnvRequest, method), visibility)
-
-PHP_HTTP_EMPTY_ARGS(__construct);
-
-PHP_HTTP_BEGIN_ARGS(getQuery, 0)
- PHP_HTTP_ARG_VAL(name, 0)
- PHP_HTTP_ARG_VAL(type, 0)
- PHP_HTTP_ARG_VAL(defval, 0)
- PHP_HTTP_ARG_VAL(delete, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(getForm, 0)
- PHP_HTTP_ARG_VAL(name, 0)
- PHP_HTTP_ARG_VAL(type, 0)
- PHP_HTTP_ARG_VAL(defval, 0)
- PHP_HTTP_ARG_VAL(delete, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getFiles);
-
-static zend_class_entry *php_http_env_request_class_entry;
-
-zend_class_entry *php_http_env_request_get_class_entry(void)
-{
- return php_http_env_request_class_entry;
-}
-
-zend_function_entry php_http_env_request_method_entry[] = {
- PHP_HTTP_ENV_REQUEST_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_HTTP_ENV_REQUEST_ME(getForm, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_REQUEST_ME(getQuery, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_REQUEST_ME(getFiles, ZEND_ACC_PUBLIC)
-
- EMPTY_FUNCTION_ENTRY
-};
-
static int grab_file(void *zpp TSRMLS_DC, int argc, va_list argv, zend_hash_key *key)
{
zval *zfiles, **name, **zname, **error, **zerror, **type, **ztype, **size, **zsize, **tmp_name = zpp;
} \
} while(0)
-PHP_METHOD(HttpEnvRequest, __construct)
+
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvRequest___construct, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvRequest, __construct)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
if (SUCCESS == zend_parse_parameters_none()) {
zval *zsg, *zqs;
obj->message = php_http_message_init_env(obj->message, PHP_HTTP_REQUEST TSRMLS_CC);
- obj->body.handle = 0;
+ obj->body = NULL;
zsg = php_http_env_get_superglobal(ZEND_STRL("_GET") TSRMLS_CC);
MAKE_STD_ZVAL(zqs);
- object_init_ex(zqs, php_http_querystring_get_class_entry());
+ object_init_ex(zqs, php_http_querystring_class_entry);
if (SUCCESS == php_http_querystring_ctor(zqs, zsg TSRMLS_CC)) {
zend_update_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("query"), zqs TSRMLS_CC);
}
zsg = php_http_env_get_superglobal(ZEND_STRL("_POST") TSRMLS_CC);
MAKE_STD_ZVAL(zqs);
- object_init_ex(zqs, php_http_querystring_get_class_entry());
+ object_init_ex(zqs, php_http_querystring_class_entry);
if (SUCCESS == php_http_querystring_ctor(zqs, zsg TSRMLS_CC)) {
zend_update_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("form"), zqs TSRMLS_CC);
}
RETVAL_ZVAL(rv, 0, 1); \
} while(0);
-PHP_METHOD(HttpEnvRequest, getForm)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvRequest_getForm, 0, 0, 0)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, defval)
+ ZEND_ARG_INFO(0, delete)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvRequest, getForm)
{
if (ZEND_NUM_ARGS()) {
call_querystring_get("form");
} else {
- RETURN_PROP(php_http_env_request_class_entry, "form");
+ zval *zform = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("form"), 0 TSRMLS_CC);
+ RETURN_ZVAL(zform, 1, 0);
}
}
-PHP_METHOD(HttpEnvRequest, getQuery)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvRequest_getQuery, 0, 0, 0)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, defval)
+ ZEND_ARG_INFO(0, delete)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvRequest, getQuery)
{
if (ZEND_NUM_ARGS()) {
call_querystring_get("query");
} else {
- RETURN_PROP(php_http_env_request_class_entry, "query");
+ zval *zquery = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("query"), 0 TSRMLS_CC);
+ RETURN_ZVAL(zquery, 1, 0);
}
}
-PHP_METHOD(HttpEnvRequest, getFiles)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvRequest_getFiles, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvRequest, getFiles)
{
if (SUCCESS == zend_parse_parameters_none()) {
- RETURN_PROP(php_http_env_request_class_entry, "files");
+ zval *zfiles = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("files"), 0 TSRMLS_CC);
+ RETURN_ZVAL(zfiles, 1, 0);
}
}
+static zend_function_entry php_http_env_request_methods[] = {
+ PHP_ME(HttpEnvRequest, __construct, ai_HttpEnvRequest___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_ME(HttpEnvRequest, getForm, ai_HttpEnvRequest_getForm, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvRequest, getQuery, ai_HttpEnvRequest_getQuery, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvRequest, getFiles, ai_HttpEnvRequest_getFiles, ZEND_ACC_PUBLIC)
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_env_request_class_entry;
PHP_MINIT_FUNCTION(http_env_request)
{
- PHP_HTTP_REGISTER_CLASS(http\\Env, Request, http_env_request, php_http_message_get_class_entry(), 0);
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http\\Env", "Request", php_http_env_request_methods);
+ php_http_env_request_class_entry = zend_register_internal_class_ex(&ce, php_http_message_class_entry, NULL TSRMLS_CC);
+
zend_declare_property_null(php_http_env_request_class_entry, ZEND_STRL("query"), ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(php_http_env_request_class_entry, ZEND_STRL("form"), ZEND_ACC_PROTECTED TSRMLS_CC);
zend_declare_property_null(php_http_env_request_class_entry, ZEND_STRL("files"), ZEND_ACC_PROTECTED TSRMLS_CC);
return SUCCESS;
}
-
/*
* Local variables:
* tab-width: 4
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#ifndef PHP_HTTP_ENV_REQUEST_H
#define PHP_HTTP_ENV_REQUEST_H
-zend_class_entry *php_http_env_request_get_class_entry(void);
-
-PHP_METHOD(HttpEnvRequest, __construct);
-PHP_METHOD(HttpEnvRequest, getForm);
-PHP_METHOD(HttpEnvRequest, getQuery);
-PHP_METHOD(HttpEnvRequest, getFiles);
-
+PHP_HTTP_API zend_class_entry *php_http_env_request_class_entry;
PHP_MINIT_FUNCTION(http_env_request);
#endif
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
php_http_message_body_t *body = NULL;
if ((zbody = get_option(options, ZEND_STRL("body") TSRMLS_CC))) {
- if ((Z_TYPE_P(zbody) == IS_OBJECT) && instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_get_class_entry() TSRMLS_CC)) {
+ if ((Z_TYPE_P(zbody) == IS_OBJECT) && instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry TSRMLS_CC)) {
php_http_message_body_object_t *body_obj = zend_object_store_get_object(zbody TSRMLS_CC);
body = body_obj->body;
php_http_message_t *request = NULL;
if ((zrequest = get_option(options, ZEND_STRL("request") TSRMLS_CC))) {
- if (Z_TYPE_P(zrequest) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zrequest), php_http_message_get_class_entry() TSRMLS_CC)) {
+ if (Z_TYPE_P(zrequest) == IS_OBJECT && instanceof_function(Z_OBJCE_P(zrequest), php_http_message_class_entry TSRMLS_CC)) {
php_http_message_object_t *request_obj = zend_object_store_get_object(zrequest TSRMLS_CC);
request = request_obj->message;
return &php_http_env_response_stream_ops;
}
-#undef PHP_HTTP_BEGIN_ARGS
-#undef PHP_HTTP_EMPTY_ARGS
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpEnvResponse, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpEnvResponse, method, 0)
-#define PHP_HTTP_ENV_RESPONSE_ME(method, visibility) PHP_ME(HttpEnvResponse, method, PHP_HTTP_ARGS(HttpEnvResponse, method), visibility)
-
-PHP_HTTP_EMPTY_ARGS(__construct);
-
-PHP_HTTP_BEGIN_ARGS(__invoke, 1)
- PHP_HTTP_ARG_VAL(ob_string, 0)
- PHP_HTTP_ARG_VAL(ob_flags, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setEnvRequest, 1)
- PHP_HTTP_ARG_OBJ(http\\Message, env_request, 1)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setContentType, 1)
- PHP_HTTP_ARG_VAL(content_type, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setContentEncoding, 1)
- PHP_HTTP_ARG_VAL(content_encoding, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setContentDisposition, 1)
- PHP_HTTP_ARG_ARR(disposition_params, 1, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setCacheControl, 1)
- PHP_HTTP_ARG_VAL(cache_control, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setLastModified, 1)
- PHP_HTTP_ARG_VAL(last_modified, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(isCachedByLastModified, 0)
- PHP_HTTP_ARG_VAL(header_name, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setEtag, 1)
- PHP_HTTP_ARG_VAL(etag, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(isCachedByEtag, 0)
- PHP_HTTP_ARG_VAL(header_name, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setThrottleRate, 1)
- PHP_HTTP_ARG_VAL(chunk_size, 0)
- PHP_HTTP_ARG_VAL(delay, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(send);
-
-static zend_class_entry *php_http_env_response_class_entry;
-
-zend_class_entry *php_http_env_response_get_class_entry(void)
-{
- return php_http_env_response_class_entry;
-}
-
-static zend_function_entry php_http_env_response_method_entry[] = {
- PHP_HTTP_ENV_RESPONSE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_HTTP_ENV_RESPONSE_ME(__invoke, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_RESPONSE_ME(setEnvRequest, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_RESPONSE_ME(setContentType, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_RESPONSE_ME(setContentDisposition, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_RESPONSE_ME(setContentEncoding, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_RESPONSE_ME(setCacheControl, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_RESPONSE_ME(setLastModified, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_RESPONSE_ME(isCachedByLastModified, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_RESPONSE_ME(setEtag, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_RESPONSE_ME(isCachedByEtag, ZEND_ACC_PUBLIC)
- PHP_HTTP_ENV_RESPONSE_ME(setThrottleRate, ZEND_ACC_PUBLIC)
-
- PHP_HTTP_ENV_RESPONSE_ME(send, ZEND_ACC_PUBLIC)
-
- EMPTY_FUNCTION_ENTRY
-};
-
#define PHP_HTTP_ENV_RESPONSE_OBJECT_INIT(obj) \
do { \
if (!obj->message) { \
} \
} while (0)
-PHP_METHOD(HttpEnvResponse, __construct)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse___construct, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, __construct)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
if (SUCCESS == zend_parse_parameters_none()) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
obj->message = php_http_message_init_env(obj->message, PHP_HTTP_RESPONSE TSRMLS_CC);
} end_error_handling();
}
}
-PHP_METHOD(HttpEnvResponse, __invoke)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse___invoke, 0, 0, 1)
+ ZEND_ARG_INFO(0, ob_string)
+ ZEND_ARG_INFO(0, ob_flags)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, __invoke)
{
char *ob_str;
int ob_len;
PHP_HTTP_ENV_RESPONSE_OBJECT_INIT(obj);
- if (obj->body.handle || SUCCESS == php_http_new(&obj->body, php_http_message_body_get_class_entry(), (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_init(&obj->message->body, NULL TSRMLS_CC), NULL TSRMLS_CC)) {
+ if (obj->body || SUCCESS == php_http_new(NULL, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_init(&obj->message->body, NULL TSRMLS_CC), (void *) &obj->body TSRMLS_CC)) {
php_http_message_body_append(obj->message->body, ob_str, ob_len);
RETURN_TRUE;
}
}
}
-PHP_METHOD(HttpEnvResponse, setEnvRequest)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_setEnvRequest, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, env_request, http\\Message, 1)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, setEnvRequest)
{
zval *env_req = NULL;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O", &env_req, php_http_message_get_class_entry())) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|O", &env_req, php_http_message_class_entry)) {
set_option(getThis(), ZEND_STRL("request"), IS_OBJECT, env_req, 0 TSRMLS_CC);
}
}
-PHP_METHOD(HttpEnvResponse, setContentType)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_setContentType, 0, 0, 1)
+ ZEND_ARG_INFO(0, content_type)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, setContentType)
{
char *ct_str = NULL;
int ct_len = 0;
}
}
-PHP_METHOD(HttpEnvResponse, setContentDisposition)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_setContentDisposition, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, disposition_params, 1)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, setContentDisposition)
{
zval *zdisposition;
}
}
-PHP_METHOD(HttpEnvResponse, setContentEncoding)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_setContentEncoding, 0, 0, 1)
+ ZEND_ARG_INFO(0, content_encoding)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, setContentEncoding)
{
long ce;
}
}
-PHP_METHOD(HttpEnvResponse, setCacheControl)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_setCacheControl, 0, 0, 1)
+ ZEND_ARG_INFO(0, cache_control)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, setCacheControl)
{
char *cc_str = NULL;
int cc_len = 0;
}
}
-PHP_METHOD(HttpEnvResponse, setLastModified)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_setLastModified, 0, 0, 1)
+ ZEND_ARG_INFO(0, last_modified)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, setLastModified)
{
long last_modified;
}
}
-PHP_METHOD(HttpEnvResponse, isCachedByLastModified)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_isCachedByLastModified, 0, 0, 0)
+ ZEND_ARG_INFO(0, header_name)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, isCachedByLastModified)
{
char *header_name_str = NULL;
int header_name_len = 0;
RETURN_FALSE;
}
-PHP_METHOD(HttpEnvResponse, setEtag)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_setEtag, 0, 0, 1)
+ ZEND_ARG_INFO(0, etag)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, setEtag)
{
char *etag_str = NULL;
int etag_len = 0;
}
}
-PHP_METHOD(HttpEnvResponse, isCachedByEtag)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_isCachedByEtag, 0, 0, 0)
+ ZEND_ARG_INFO(0, header_name)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, isCachedByEtag)
{
char *header_name_str = NULL;
int header_name_len = 0;
RETURN_FALSE;
}
-PHP_METHOD(HttpEnvResponse, setThrottleRate)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_setThrottleRate, 0, 0, 1)
+ ZEND_ARG_INFO(0, chunk_size)
+ ZEND_ARG_INFO(0, delay)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, setThrottleRate)
{
long chunk_size;
double delay = 1;
RETURN_FALSE;
}
-PHP_METHOD(HttpEnvResponse, send)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpEnvResponse_send, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpEnvResponse, send)
{
zval *zstream = NULL;
php_stream *s = NULL;
php_http_env_response_t *r;
if ((r = php_http_env_response_init(NULL, getThis(), php_http_env_response_get_stream_ops(), s TSRMLS_CC))) {
- RETVAL_SUCCESS(php_http_env_response_send(r));
+ RETVAL_BOOL(SUCCESS == php_http_env_response_send(r));
php_http_env_response_free(&r);
}
}
php_http_env_response_t r;
if (php_http_env_response_init(&r, getThis(), NULL, NULL TSRMLS_CC)) {
- RETVAL_SUCCESS(php_http_env_response_send(&r));
+ RETVAL_BOOL(SUCCESS == php_http_env_response_send(&r));
php_http_env_response_dtor(&r);
}
}
}
}
+static zend_function_entry php_http_env_response_methods[] = {
+ PHP_ME(HttpEnvResponse, __construct, ai_HttpEnvResponse___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_ME(HttpEnvResponse, __invoke, ai_HttpEnvResponse___invoke, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, setEnvRequest, ai_HttpEnvResponse_setEnvRequest, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, setContentType, ai_HttpEnvResponse_setContentType, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, setContentDisposition, ai_HttpEnvResponse_setContentDisposition, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, setContentEncoding, ai_HttpEnvResponse_setContentEncoding, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, setCacheControl, ai_HttpEnvResponse_setCacheControl, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, setLastModified, ai_HttpEnvResponse_setLastModified, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, isCachedByLastModified, ai_HttpEnvResponse_isCachedByLastModified, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, setEtag, ai_HttpEnvResponse_setEtag, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, isCachedByEtag, ai_HttpEnvResponse_isCachedByEtag, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, setThrottleRate, ai_HttpEnvResponse_setThrottleRate, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpEnvResponse, send, ai_HttpEnvResponse_send, ZEND_ACC_PUBLIC)
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_env_response_class_entry;
+
PHP_MINIT_FUNCTION(http_env_response)
{
- PHP_HTTP_REGISTER_CLASS(http\\Env, Response, http_env_response, php_http_message_get_class_entry(), 0);
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http\\Env", "Response", php_http_env_response_methods);
+ php_http_env_response_class_entry = zend_register_internal_class_ex(&ce, php_http_message_class_entry, NULL TSRMLS_CC);
zend_declare_class_constant_long(php_http_env_response_class_entry, ZEND_STRL("CONTENT_ENCODING_NONE"), PHP_HTTP_CONTENT_ENCODING_NONE TSRMLS_CC);
zend_declare_class_constant_long(php_http_env_response_class_entry, ZEND_STRL("CONTENT_ENCODING_GZIP"), PHP_HTTP_CONTENT_ENCODING_GZIP TSRMLS_CC);
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
PHP_HTTP_API php_http_cache_status_t php_http_env_is_response_cached_by_etag(zval *options, const char *header_str, size_t header_len, php_http_message_t *request TSRMLS_DC);
PHP_HTTP_API php_http_cache_status_t php_http_env_is_response_cached_by_last_modified(zval *options, const char *header_str, size_t header_len, php_http_message_t *request TSRMLS_DC);
-zend_class_entry *php_http_env_response_get_class_entry(void);
-
-PHP_METHOD(HttpEnvResponse, __construct);
-PHP_METHOD(HttpEnvResponse, __invoke);
-PHP_METHOD(HttpEnvResponse, setEnvRequest);
-PHP_METHOD(HttpEnvResponse, setContentType);
-PHP_METHOD(HttpEnvResponse, setContentDisposition);
-PHP_METHOD(HttpEnvResponse, setContentEncoding);
-PHP_METHOD(HttpEnvResponse, setCacheControl);
-PHP_METHOD(HttpEnvResponse, setLastModified);
-PHP_METHOD(HttpEnvResponse, isCachedByLastModified);
-PHP_METHOD(HttpEnvResponse, setEtag);
-PHP_METHOD(HttpEnvResponse, isCachedByEtag);
-PHP_METHOD(HttpEnvResponse, setThrottleRate);
-PHP_METHOD(HttpEnvResponse, send);
-
-
+PHP_HTTP_API zend_class_entry *php_http_env_response_class_entry;
PHP_MINIT_FUNCTION(http_env_response);
#endif
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
# define PHP_HTTP_DBG_EXCEPTIONS 0
#endif
-static zend_class_entry *php_http_exception_class_entry;
-
-zend_class_entry *php_http_exception_get_class_entry(void)
-{
- return php_http_exception_class_entry;
-}
-
#if PHP_HTTP_DBG_EXCEPTIONS
static void php_http_exception_hook(zval *ex TSRMLS_DC)
{
}
#endif
+zend_class_entry *php_http_exception_class_entry;
+
PHP_MINIT_FUNCTION(http_exception)
{
- PHP_HTTP_REGISTER_EXCEPTION(Exception, php_http_exception_class_entry, zend_exception_get_default(TSRMLS_C));
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http", "Exception", NULL);
+ php_http_exception_class_entry = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_UNKNOWN"), PHP_HTTP_E_UNKNOWN TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_RUNTIME"), PHP_HTTP_E_RUNTIME TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_INVALID_PARAM"), PHP_HTTP_E_INVALID_PARAM TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_HEADER"), PHP_HTTP_E_HEADER TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_MALFORMED_HEADERS"), PHP_HTTP_E_MALFORMED_HEADERS TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_MESSAGE"), PHP_HTTP_E_MESSAGE TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_MESSAGE_TYPE"), PHP_HTTP_E_MESSAGE_TYPE TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_MESSAGE_BODY"), PHP_HTTP_E_MESSAGE_BODY TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_ENCODING"), PHP_HTTP_E_ENCODING TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_CLIENT"), PHP_HTTP_E_CLIENT TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_CLIENT_POOL"), PHP_HTTP_E_CLIENT_POOL TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_CLIENT_DATASHARE"), PHP_HTTP_E_CLIENT_DATASHARE TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_SOCKET"), PHP_HTTP_E_SOCKET TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_RESPONSE"), PHP_HTTP_E_RESPONSE TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_URL"), PHP_HTTP_E_URL TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_QUERYSTRING"), PHP_HTTP_E_QUERYSTRING TSRMLS_CC);
- zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_COOKIE"), PHP_HTTP_E_COOKIE TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_UNKNOWN"), PHP_HTTP_E_UNKNOWN TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_RUNTIME"), PHP_HTTP_E_RUNTIME TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_INVALID_PARAM"), PHP_HTTP_E_INVALID_PARAM TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_HEADER"), PHP_HTTP_E_HEADER TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_MALFORMED_HEADERS"), PHP_HTTP_E_MALFORMED_HEADERS TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_MESSAGE"), PHP_HTTP_E_MESSAGE TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_MESSAGE_TYPE"), PHP_HTTP_E_MESSAGE_TYPE TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_MESSAGE_BODY"), PHP_HTTP_E_MESSAGE_BODY TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_ENCODING"), PHP_HTTP_E_ENCODING TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_CLIENT"), PHP_HTTP_E_CLIENT TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_CLIENT_POOL"), PHP_HTTP_E_CLIENT_POOL TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_CLIENT_DATASHARE"), PHP_HTTP_E_CLIENT_DATASHARE TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_SOCKET"), PHP_HTTP_E_SOCKET TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_RESPONSE"), PHP_HTTP_E_RESPONSE TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_URL"), PHP_HTTP_E_URL TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_QUERYSTRING"), PHP_HTTP_E_QUERYSTRING TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_COOKIE"), PHP_HTTP_E_COOKIE TSRMLS_CC);
#if PHP_HTTP_DBG_EXCEPTIONS
zend_throw_exception_hook = php_http_exception_hook;
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#ifndef PHP_HTTP_EXCEPTION_H
#define PHP_HTTP_EXCEPTION_H
-zend_class_entry *php_http_exception_get_class_entry(void);
-
+PHP_HTTP_API zend_class_entry *php_http_exception_class_entry;
PHP_MINIT_FUNCTION(http_exception);
#endif
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
{PHP_HTTP_HEADER_PARSER_STATE_DONE, 0}
};
-
PHP_HTTP_API php_http_header_parser_t *php_http_header_parser_init(php_http_header_parser_t *parser TSRMLS_DC)
{
if (!parser) {
return parser;
}
-
PHP_HTTP_API php_http_header_parser_state_t php_http_header_parser_state_push(php_http_header_parser_t *parser, unsigned argc, ...)
{
va_list va_args;
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
return ret;
}
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpHeader, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpHeader, method, 0)
-#define PHP_HTTP_HEADER_ME(method, v) PHP_ME(HttpHeader, method, PHP_HTTP_ARGS(HttpHeader, method), v)
-
-PHP_HTTP_BEGIN_ARGS(__construct, 0)
- PHP_HTTP_ARG_VAL(name, 0)
- PHP_HTTP_ARG_VAL(value, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(serialize);
-PHP_HTTP_BEGIN_ARGS(unserialize, 1)
- PHP_HTTP_ARG_VAL(serialized, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(match, 1)
- PHP_HTTP_ARG_VAL(value, 0)
- PHP_HTTP_ARG_VAL(flags, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(negotiate, 1)
- PHP_HTTP_ARG_VAL(supported, 0)
- PHP_HTTP_ARG_VAL(result, 1)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(parse, 1)
- PHP_HTTP_ARG_VAL(string, 0)
- PHP_HTTP_ARG_VAL(flags, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(getParams, 0)
- PHP_HTTP_ARG_VAL(param_sep, 0)
- PHP_HTTP_ARG_VAL(arg_sep, 0)
- PHP_HTTP_ARG_VAL(val_sep, 0)
- PHP_HTTP_ARG_VAL(flags, 0)
-PHP_HTTP_END_ARGS;
-
-static zend_class_entry *php_http_header_class_entry;
-
-zend_class_entry *php_http_header_get_class_entry(void)
-{
- return php_http_header_class_entry;
-}
-
-static zend_function_entry php_http_header_method_entry[] = {
- PHP_HTTP_HEADER_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_HTTP_HEADER_ME(serialize, ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpHeader, __toString, serialize, PHP_HTTP_ARGS(HttpHeader, serialize), ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpHeader, toString, serialize, PHP_HTTP_ARGS(HttpHeader, serialize), ZEND_ACC_PUBLIC)
- PHP_HTTP_HEADER_ME(unserialize, ZEND_ACC_PUBLIC)
- PHP_HTTP_HEADER_ME(match, ZEND_ACC_PUBLIC)
- PHP_HTTP_HEADER_ME(negotiate, ZEND_ACC_PUBLIC)
- PHP_HTTP_HEADER_ME(getParams, ZEND_ACC_PUBLIC)
- PHP_HTTP_HEADER_ME(parse, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- EMPTY_FUNCTION_ENTRY
-};
-
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpHeader, __construct)
{
char *name_str = NULL, *value_str = NULL;
int name_len = 0, value_len = 0;
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!", &name_str, &name_len, &value_str, &value_len)) {
if (name_str && name_len) {
char *pretty_str = estrndup(name_str, name_len);
} end_error_handling();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_serialize, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpHeader, serialize)
{
php_http_buffer_t buf;
RETURN_PHP_HTTP_BUFFER_VAL(&buf);
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpHeader, unserialize)
{
char *serialized_str;
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_match, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpHeader, match)
{
char *val_str;
zval_ptr_dtor(&zvalue);
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_negotiate, 0, 0, 1)
+ ZEND_ARG_INFO(0, supported)
+ ZEND_ARG_INFO(1, result)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpHeader, negotiate)
{
HashTable *supported, *rs;
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_getParams, 0, 0, 0)
+ ZEND_ARG_INFO(0, param_sep)
+ ZEND_ARG_INFO(0, arg_sep)
+ ZEND_ARG_INFO(0, val_sep)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpHeader, getParams)
{
zval zctor, *zparams_obj, **zargs = NULL;
ZVAL_STRINGL(&zctor, "__construct", lenof("__construct"), 0);
MAKE_STD_ZVAL(zparams_obj);
- object_init_ex(zparams_obj, php_http_params_get_class_entry());
+ object_init_ex(zparams_obj, php_http_params_class_entry);
zargs = (zval **) ecalloc(ZEND_NUM_ARGS()+1, sizeof(zval *));
zargs[0] = zend_read_property(Z_OBJCE_P(getThis()), getThis(), ZEND_STRL("value"), 0 TSRMLS_CC);
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpHeader_parse, 0, 0, 1)
+ ZEND_ARG_INFO(0, string)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpHeader, parse)
{
char *header_str;
}
}
+static zend_function_entry php_http_header_methods[] = {
+ PHP_ME(HttpHeader, __construct, ai_HttpHeader___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_ME(HttpHeader, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpHeader, __toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpHeader, toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpHeader, unserialize, ai_HttpHeader_unserialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpHeader, match, ai_HttpHeader_match, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpHeader, negotiate, ai_HttpHeader_negotiate, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpHeader, getParams, ai_HttpHeader_getParams, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpHeader, parse, ai_HttpHeader_parse, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_header_class_entry;
+
PHP_MINIT_FUNCTION(http_header)
{
- PHP_HTTP_REGISTER_CLASS(http, Header, http_header, php_http_object_get_class_entry(), 0);
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http", "Header", php_http_header_methods);
+ php_http_header_class_entry = zend_register_internal_class_ex(&ce, php_http_object_class_entry, NULL TSRMLS_CC);
zend_class_implements(php_http_header_class_entry TSRMLS_CC, 1, zend_ce_serializable);
zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_LOOSE"), PHP_HTTP_MATCH_LOOSE TSRMLS_CC);
zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_CASE"), PHP_HTTP_MATCH_CASE TSRMLS_CC);
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
PHP_HTTP_API zval *php_http_header_value_to_string(zval *header TSRMLS_DC);
-zend_class_entry *php_http_header_get_class_entry(void);
-
-PHP_METHOD(HttpHeader, __construct);
-PHP_METHOD(HttpHeader, serialize);
-PHP_METHOD(HttpHeader, unserialize);
-PHP_METHOD(HttpHeader, match);
-PHP_METHOD(HttpHeader, negotiate);
-PHP_METHOD(HttpHeader, getParams);
-PHP_METHOD(HttpHeader, parse);
-
+PHP_HTTP_API zend_class_entry *php_http_header_class_entry;
PHP_MINIT_FUNCTION(http_header);
#endif
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
}
}
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpMessage, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpMessage, method, 0)
-#define PHP_HTTP_MESSAGE_ME(method, visibility) PHP_ME(HttpMessage, method, PHP_HTTP_ARGS(HttpMessage, method), visibility)
-
-PHP_HTTP_BEGIN_ARGS(__construct, 0)
- PHP_HTTP_ARG_VAL(message, 0)
- PHP_HTTP_ARG_VAL(greedy, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getBody);
-PHP_HTTP_BEGIN_ARGS(setBody, 1)
- PHP_HTTP_ARG_VAL(body, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(addBody, 1)
- PHP_HTTP_ARG_VAL(body, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(getHeader, 1)
- PHP_HTTP_ARG_VAL(header, 0)
- PHP_HTTP_ARG_VAL(into_class, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(setHeader, 1)
- PHP_HTTP_ARG_VAL(header, 0)
- PHP_HTTP_ARG_VAL(value, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(addHeader, 2)
- PHP_HTTP_ARG_VAL(header, 0)
- PHP_HTTP_ARG_VAL(value, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getHeaders);
-PHP_HTTP_BEGIN_ARGS(setHeaders, 1)
- PHP_HTTP_ARG_VAL(headers, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(addHeaders, 1)
- PHP_HTTP_ARG_VAL(headers, 0)
- PHP_HTTP_ARG_VAL(append, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getType);
-PHP_HTTP_BEGIN_ARGS(setType, 1)
- PHP_HTTP_ARG_VAL(type, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getInfo);
-PHP_HTTP_BEGIN_ARGS(setInfo, 1)
- PHP_HTTP_ARG_VAL(http_info, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getResponseCode);
-PHP_HTTP_BEGIN_ARGS(setResponseCode, 1)
- PHP_HTTP_ARG_VAL(response_code, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getResponseStatus);
-PHP_HTTP_BEGIN_ARGS(setResponseStatus, 1)
- PHP_HTTP_ARG_VAL(response_status, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getRequestMethod);
-PHP_HTTP_BEGIN_ARGS(setRequestMethod, 1)
- PHP_HTTP_ARG_VAL(request_method, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getRequestUrl);
-PHP_HTTP_BEGIN_ARGS(setRequestUrl, 1)
- PHP_HTTP_ARG_VAL(url, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getHttpVersion);
-PHP_HTTP_BEGIN_ARGS(setHttpVersion, 1)
- PHP_HTTP_ARG_VAL(http_version, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getParentMessage);
-PHP_HTTP_EMPTY_ARGS(__toString);
-PHP_HTTP_BEGIN_ARGS(toString, 0)
- PHP_HTTP_ARG_VAL(include_parent, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(toCallback, 1)
- PHP_HTTP_ARG_VAL(callback, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_BEGIN_ARGS(toStream, 1)
- PHP_HTTP_ARG_VAL(stream, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(count);
-
-PHP_HTTP_EMPTY_ARGS(serialize);
-PHP_HTTP_BEGIN_ARGS(unserialize, 1)
- PHP_HTTP_ARG_VAL(serialized, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(rewind);
-PHP_HTTP_EMPTY_ARGS(valid);
-PHP_HTTP_EMPTY_ARGS(key);
-PHP_HTTP_EMPTY_ARGS(current);
-PHP_HTTP_EMPTY_ARGS(next);
-
-PHP_HTTP_EMPTY_ARGS(detach);
-PHP_HTTP_BEGIN_ARGS(prepend, 1)
- PHP_HTTP_ARG_OBJ(http\\Message, message, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_EMPTY_ARGS(reverse);
-
-PHP_HTTP_BEGIN_ARGS(isMultipart, 0)
- PHP_HTTP_ARG_VAL(boundary, 1)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_EMPTY_ARGS(splitMultipartBody);
-
static zval *php_http_message_object_read_prop(zval *object, zval *member, int type PHP_HTTP_ZEND_LITERAL_DC TSRMLS_DC);
static void php_http_message_object_write_prop(zval *object, zval *member, zval *value PHP_HTTP_ZEND_LITERAL_DC TSRMLS_DC);
static HashTable *php_http_message_object_get_props(zval *object TSRMLS_DC);
-static zend_class_entry *php_http_message_class_entry;
-
-zend_class_entry *php_http_message_get_class_entry(void)
-{
- return php_http_message_class_entry;
-}
-
-static zend_function_entry php_http_message_method_entry[] = {
- PHP_HTTP_MESSAGE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_HTTP_MESSAGE_ME(getBody, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(setBody, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(addBody, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(getHeader, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(setHeader, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(addHeader, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(getHeaders, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(setHeaders, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(addHeaders, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(getType, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(setType, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(getInfo, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(setInfo, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(getResponseCode, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(setResponseCode, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(getResponseStatus, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(setResponseStatus, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(getRequestMethod, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(setRequestMethod, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(getRequestUrl, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(setRequestUrl, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(getHttpVersion, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(setHttpVersion, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(getParentMessage, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(toString, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(toCallback, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(toStream, ZEND_ACC_PUBLIC)
-
- /* implements Countable */
- PHP_HTTP_MESSAGE_ME(count, ZEND_ACC_PUBLIC)
-
- /* implements Serializable */
- PHP_HTTP_MESSAGE_ME(serialize, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(unserialize, ZEND_ACC_PUBLIC)
-
- /* implements Iterator */
- PHP_HTTP_MESSAGE_ME(rewind, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(valid, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(current, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(key, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(next, ZEND_ACC_PUBLIC)
-
- ZEND_MALIAS(HttpMessage, __toString, toString, PHP_HTTP_ARGS(HttpMessage, __toString), ZEND_ACC_PUBLIC)
-
- PHP_HTTP_MESSAGE_ME(detach, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(prepend, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(reverse, ZEND_ACC_PUBLIC)
-
- PHP_HTTP_MESSAGE_ME(isMultipart, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_ME(splitMultipartBody, ZEND_ACC_PUBLIC)
-
- EMPTY_FUNCTION_ENTRY
-};
static zend_object_handlers php_http_message_object_handlers;
static HashTable php_http_message_object_prophandlers;
zval_ptr_dtor(&cpy);
}
static void php_http_message_object_prophandler_get_body(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
- if (obj->body.handle) {
- RETVAL_OBJVAL(obj->body, 1);
+ if (obj->body) {
+ RETVAL_OBJVAL(obj->body->zv, 1);
} else {
RETVAL_NULL();
}
}
static void php_http_message_object_prophandler_get_parent_message(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
if (obj->message->parent) {
- RETVAL_OBJVAL(obj->parent, 1);
+ RETVAL_OBJVAL(obj->parent->zv, 1);
} else {
RETVAL_NULL();
}
php_http_message_object_t *parent_obj = zend_object_store_get_object(value TSRMLS_CC);
if (obj->message->parent) {
- zend_objects_store_del_ref_by_handle(obj->parent.handle TSRMLS_CC);
+ zend_objects_store_del_ref_by_handle(obj->parent->zv.handle TSRMLS_CC);
}
Z_OBJ_ADDREF_P(value);
- obj->parent = Z_OBJVAL_P(value);
+ obj->parent = parent_obj;
obj->message->parent = parent_obj->message;
}
}
-PHP_MINIT_FUNCTION(http_message)
-{
- PHP_HTTP_REGISTER_CLASS(http, Message, http_message, php_http_object_get_class_entry(), 0);
- php_http_message_class_entry->create_object = php_http_message_object_new;
- memcpy(&php_http_message_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_http_message_object_handlers.clone_obj = php_http_message_object_clone;
- php_http_message_object_handlers.read_property = php_http_message_object_read_prop;
- php_http_message_object_handlers.write_property = php_http_message_object_write_prop;
- php_http_message_object_handlers.get_properties = php_http_message_object_get_props;
- php_http_message_object_handlers.get_property_ptr_ptr = NULL;
-
- zend_class_implements(php_http_message_class_entry TSRMLS_CC, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator);
-
- zend_hash_init(&php_http_message_object_prophandlers, 9, NULL, NULL, 1);
- zend_declare_property_long(php_http_message_class_entry, ZEND_STRL("type"), PHP_HTTP_NONE, ZEND_ACC_PROTECTED TSRMLS_CC);
- php_http_message_object_add_prophandler(ZEND_STRL("type"), php_http_message_object_prophandler_get_type, php_http_message_object_prophandler_set_type);
- zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("body"), ZEND_ACC_PROTECTED TSRMLS_CC);
- php_http_message_object_add_prophandler(ZEND_STRL("body"), php_http_message_object_prophandler_get_body, php_http_message_object_prophandler_set_body);
- zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("requestMethod"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
- php_http_message_object_add_prophandler(ZEND_STRL("requestMethod"), php_http_message_object_prophandler_get_request_method, php_http_message_object_prophandler_set_request_method);
- zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("requestUrl"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
- php_http_message_object_add_prophandler(ZEND_STRL("requestUrl"), php_http_message_object_prophandler_get_request_url, php_http_message_object_prophandler_set_request_url);
- zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("responseStatus"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
- php_http_message_object_add_prophandler(ZEND_STRL("responseStatus"), php_http_message_object_prophandler_get_response_status, php_http_message_object_prophandler_set_response_status);
- zend_declare_property_long(php_http_message_class_entry, ZEND_STRL("responseCode"), 0, ZEND_ACC_PROTECTED TSRMLS_CC);
- php_http_message_object_add_prophandler(ZEND_STRL("responseCode"), php_http_message_object_prophandler_get_response_code, php_http_message_object_prophandler_set_response_code);
- zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("httpVersion"), ZEND_ACC_PROTECTED TSRMLS_CC);
- php_http_message_object_add_prophandler(ZEND_STRL("httpVersion"), php_http_message_object_prophandler_get_http_version, php_http_message_object_prophandler_set_http_version);
- zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("headers"), ZEND_ACC_PROTECTED TSRMLS_CC);
- php_http_message_object_add_prophandler(ZEND_STRL("headers"), php_http_message_object_prophandler_get_headers, php_http_message_object_prophandler_set_headers);
- zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("parentMessage"), ZEND_ACC_PROTECTED TSRMLS_CC);
- php_http_message_object_add_prophandler(ZEND_STRL("parentMessage"), php_http_message_object_prophandler_get_parent_message, php_http_message_object_prophandler_set_parent_message);
-
- zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_NONE"), PHP_HTTP_NONE TSRMLS_CC);
- zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_REQUEST"), PHP_HTTP_REQUEST TSRMLS_CC);
- zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_RESPONSE"), PHP_HTTP_RESPONSE TSRMLS_CC);
-
- return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(http_message)
-{
- zend_hash_destroy(&php_http_message_object_prophandlers);
-
- return SUCCESS;
-}
-
#define PHP_HTTP_MESSAGE_OBJECT_INIT(obj) \
do { \
if (!obj->message) { \
php_http_message_count(i, obj->message);
if (i > 1) {
- zend_object_value *ovalues = NULL;
- php_http_message_object_t **objects = NULL;
+ php_http_message_object_t **objects;
int last;
objects = ecalloc(i, sizeof(**objects));
- ovalues = ecalloc(i, sizeof(*ovalues));
/* we are the first message */
objects[0] = obj;
- ovalues[0] = getThis()->value.obj;
/* fetch parents */
- for (i = 1; obj->parent.handle; ++i) {
- ovalues[i] = obj->parent;
- objects[i] = obj = zend_object_store_get_object_by_handle(obj->parent.handle TSRMLS_CC);
+ for (i = 1; obj->parent; ++i) {
+ objects[i] = obj = obj->parent;
}
/* reorder parents */
for (last = --i; i; --i) {
objects[i]->message->parent = objects[i-1]->message;
- objects[i]->parent = ovalues[i-1];
+ objects[i]->parent = objects[i-1];
}
objects[0]->message->parent = NULL;
- objects[0]->parent.handle = 0;
- objects[0]->parent.handlers = NULL;
+ objects[0]->parent = NULL;
/* add ref, because we previously have not been a parent message */
Z_OBJ_ADDREF_P(getThis());
- RETVAL_OBJVAL(ovalues[last], 1);
+ RETVAL_OBJVAL(objects[last]->zv, 0);
efree(objects);
- efree(ovalues);
} else {
RETURN_ZVAL(getThis(), 1, 0);
}
{
zval m;
php_http_message_t *save_parent_msg = NULL;
- zend_object_value save_parent_obj = {0, NULL};
- php_http_message_object_t *obj = zend_object_store_get_object(this_ptr TSRMLS_CC);
+ php_http_message_object_t *save_parent_obj = NULL, *obj = zend_object_store_get_object(this_ptr TSRMLS_CC);
php_http_message_object_t *prepend_obj = zend_object_store_get_object(prepend TSRMLS_CC);
INIT_PZVAL(&m);
save_parent_msg = obj->message->parent;
} else {
/* iterate to the most parent object */
- while (obj->parent.handle) {
- m.value.obj = obj->parent;
- obj = zend_object_store_get_object(&m TSRMLS_CC);
+ while (obj->parent) {
+ obj = obj->parent;
}
}
/* prepend */
- obj->parent = prepend->value.obj;
+ obj->parent = prepend_obj;
obj->message->parent = prepend_obj->message;
/* add ref */
zend_objects_store_add_ref(prepend TSRMLS_CC);
- while (prepend_obj->parent.handle) {
- m.value.obj = prepend_obj->parent;
+ /*
+ while (prepend_obj->parent) {
+ m.value.obj = prepend_obj->parent->zv;
zend_objects_store_add_ref(&m TSRMLS_CC);
prepend_obj = zend_object_store_get_object(&m TSRMLS_CC);
}
-
+ */
if (!top) {
prepend_obj->parent = save_parent_obj;
prepend_obj->message->parent = save_parent_msg;
is_resource:
body = php_http_message_body_init(NULL, s TSRMLS_CC);
- if (SUCCESS != php_http_new(&ov, php_http_message_body_get_class_entry(), (php_http_new_t) php_http_message_body_object_new_ex, NULL, body, NULL TSRMLS_CC)) {
+ if (SUCCESS != php_http_new(&ov, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, body, NULL TSRMLS_CC)) {
php_http_message_body_free(&body);
return FAILURE;
}
break;
case IS_OBJECT:
- if (instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_get_class_entry() TSRMLS_CC)) {
+ if (instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry TSRMLS_CC)) {
Z_OBJ_ADDREF_P(zbody);
break;
}
body_obj = zend_object_store_get_object(zbody TSRMLS_CC);
- if (msg_obj->body.handle) {
- zend_objects_store_del_ref_by_handle(msg_obj->body.handle TSRMLS_CC);
+ if (msg_obj->body) {
+ zend_objects_store_del_ref_by_handle(msg_obj->body->zv.handle TSRMLS_CC);
}
php_http_message_body_free(&msg_obj->message->body);
msg_obj->message->body = php_http_message_body_init(&body_obj->body, NULL TSRMLS_CC);
- msg_obj->body = Z_OBJVAL_P(zbody);
+ msg_obj->body = body_obj;
if (tmp) {
FREE_ZVAL(tmp);
if (msg) {
o->message = msg;
if (msg->parent) {
- o->parent = php_http_message_object_new_ex(ce, msg->parent, NULL TSRMLS_CC);
+ php_http_message_object_new_ex(ce, msg->parent, &o->parent TSRMLS_CC);
}
- o->body = php_http_message_body_object_new_ex(php_http_message_body_get_class_entry(), php_http_message_body_init(&msg->body, NULL TSRMLS_CC), NULL TSRMLS_CC);
+ php_http_message_body_object_new_ex(php_http_message_body_class_entry, php_http_message_body_init(&msg->body, NULL TSRMLS_CC), &o->body TSRMLS_CC);
}
o->zv.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_message_object_free, NULL TSRMLS_CC);
efree(o->message);
o->message = NULL;
}
- if (o->parent.handle) {
- zend_objects_store_del_ref_by_handle(o->parent.handle TSRMLS_CC);
+ if (o->parent) {
+ zend_objects_store_del_ref_by_handle(o->parent->zv.handle TSRMLS_CC);
+ o->parent = NULL;
}
- if (o->body.handle) {
- zend_objects_store_del_ref_by_handle(o->body.handle TSRMLS_CC);
+ if (o->body) {
+ zend_objects_store_del_ref_by_handle(o->body->zv.handle TSRMLS_CC);
+ o->body = NULL;
}
zend_object_std_dtor((zend_object *) o TSRMLS_CC);
efree(o);
ASSOC_PROP(zval, "headers", headers);
MAKE_STD_ZVAL(body);
- if (!obj->body.handle) {
- php_http_new(&obj->body, php_http_message_body_get_class_entry(), (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_init(&obj->message->body, NULL TSRMLS_CC), NULL TSRMLS_CC);
+ if (!obj->body) {
+ php_http_new(NULL, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_init(&obj->message->body, NULL TSRMLS_CC), (void *) &obj->body TSRMLS_CC);
}
- ZVAL_OBJVAL(body, obj->body, 1);
+ ZVAL_OBJVAL(body, obj->body->zv, 1);
ASSOC_PROP(zval, "body", body);
MAKE_STD_ZVAL(parent);
if (msg->parent) {
- ZVAL_OBJVAL(parent, obj->parent, 1);
+ ZVAL_OBJVAL(parent, obj->parent->zv, 1);
} else {
ZVAL_NULL(parent);
}
return props;
}
-/* PHP */
-
-PHP_METHOD(HttpMessage, __construct)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, message)
+ ZEND_ARG_INFO(0, greedy)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, __construct)
{
zend_bool greedy = 1;
zval *zmessage = NULL;
php_http_message_t *msg = NULL;
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!b", &zmessage, &greedy) && zmessage) {
if (Z_TYPE_P(zmessage) == IS_RESOURCE) {
php_stream *s;
php_http_message_dtor(obj->message);
obj->message = msg;
if (obj->message->parent) {
- obj->parent = php_http_message_object_new_ex(Z_OBJCE_P(getThis()), obj->message->parent, NULL TSRMLS_CC);
+ php_http_message_object_new_ex(Z_OBJCE_P(getThis()), obj->message->parent, &obj->parent TSRMLS_CC);
}
}
}
}
-PHP_METHOD(HttpMessage, getBody)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getBody, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getBody)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
- if (!obj->body.handle) {
+ if (!obj->body) {
php_http_message_body_addref(obj->message->body);
- php_http_new(&obj->body, php_http_message_body_get_class_entry(), (php_http_new_t) php_http_message_body_object_new_ex, NULL, obj->message->body, NULL TSRMLS_CC);
+ php_http_new(NULL, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, obj->message->body, (void *) &obj->body TSRMLS_CC);
}
- if (obj->body.handle) {
- RETVAL_OBJVAL(obj->body, 1);
+ if (obj->body) {
+ RETVAL_OBJVAL(obj->body->zv, 1);
}
}
} end_error_handling();
}
-PHP_METHOD(HttpMessage, setBody)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setBody, 0, 0, 1)
+ ZEND_ARG_INFO(0, body)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, setBody)
{
zval *zbody;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zbody, php_http_message_body_get_class_entry())) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zbody, php_http_message_body_class_entry)) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, addBody)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addBody, 0, 0, 1)
+ ZEND_ARG_INFO(0, body)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, addBody)
{
zval *new_body;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &new_body, php_http_message_body_get_class_entry())) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &new_body, php_http_message_body_class_entry)) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_body_object_t *new_obj = zend_object_store_get_object(new_body TSRMLS_CC);
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, getHeader)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHeader, 0, 0, 1)
+ ZEND_ARG_INFO(0, header)
+ ZEND_ARG_INFO(0, into_class)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getHeader)
{
char *header_str;
int header_len;
if ((header = php_http_message_header(obj->message, header_str, header_len, 0))) {
if (!header_ce) {
RETURN_ZVAL(header, 1, 1);
- } else if (instanceof_function(header_ce, php_http_header_get_class_entry() TSRMLS_CC)) {
+ } else if (instanceof_function(header_ce, php_http_header_class_entry TSRMLS_CC)) {
zval *header_name, **argv[2];
MAKE_STD_ZVAL(header_name);
RETURN_FALSE;
}
-PHP_METHOD(HttpMessage, getHeaders)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHeaders, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getHeaders)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
}
}
-PHP_METHOD(HttpMessage, setHeader)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setHeader, 0, 0, 1)
+ ZEND_ARG_INFO(0, header)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, setHeader)
{
zval *zvalue = NULL;
char *name_str;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, setHeaders)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setHeaders, 0, 0, 1)
+ ZEND_ARG_INFO(0, headers)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, setHeaders)
{
zval *new_headers = NULL;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, addHeader)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeader, 0, 0, 2)
+ ZEND_ARG_INFO(0, header)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, addHeader)
{
zval *zvalue;
char *name_str;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, addHeaders)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_addHeaders, 0, 0, 1)
+ ZEND_ARG_INFO(0, headers)
+ ZEND_ARG_INFO(0, append)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, addHeaders)
{
zval *new_headers;
zend_bool append = 0;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, getType)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getType, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getType)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
}
}
-PHP_METHOD(HttpMessage, setType)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setType, 0, 0, 1)
+ ZEND_ARG_INFO(0, type)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, setType)
{
long type;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, getInfo)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getInfo, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getInfo)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpMessage, setInfo)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setInfo, 0, 0, 1)
+ ZEND_ARG_INFO(0, http_info)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, setInfo)
{
char *str;
int len;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, getHttpVersion)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getHttpVersion, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getHttpVersion)
{
if (SUCCESS == zend_parse_parameters_none()) {
char *str;
RETURN_FALSE;
}
-PHP_METHOD(HttpMessage, setHttpVersion)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setHttpVersion, 0, 0, 1)
+ ZEND_ARG_INFO(0, http_version)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, setHttpVersion)
{
char *v_str;
int v_len;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, getResponseCode)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getResponseCode, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getResponseCode)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpMessage, setResponseCode)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setResponseCode, 0, 0, 1)
+ ZEND_ARG_INFO(0, response_code)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, setResponseCode)
{
long code;
zend_bool strict = 1;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, getResponseStatus)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getResponseStatus, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getResponseStatus)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpMessage, setResponseStatus)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setResponseStatus, 0, 0, 1)
+ ZEND_ARG_INFO(0, response_status)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, setResponseStatus)
{
char *status;
int status_len;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, getRequestMethod)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getRequestMethod, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getRequestMethod)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpMessage, setRequestMethod)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setRequestMethod, 0, 0, 1)
+ ZEND_ARG_INFO(0, request_method)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, setRequestMethod)
{
char *method;
int method_len;
RETVAL_ZVAL(getThis(), 1, 0);
}
-PHP_METHOD(HttpMessage, getRequestUrl)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getRequestUrl, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getRequestUrl)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_FALSE;
}
-PHP_METHOD(HttpMessage, setRequestUrl)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_setRequestUrl, 0, 0, 1)
+ ZEND_ARG_INFO(0, url)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, setRequestUrl)
{
char *url_str;
int url_len;
RETVAL_ZVAL(getThis(), 1, 0);
}
-
-PHP_METHOD(HttpMessage, getParentMessage)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_getParentMessage, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, getParentMessage)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
if (obj->message->parent) {
- RETVAL_OBJVAL(obj->parent, 1);
+ RETVAL_OBJVAL(obj->parent->zv, 1);
} else {
php_http_error(HE_WARNING, PHP_HTTP_E_RUNTIME, "HttpMessage does not have a parent message");
}
} end_error_handling();
}
-PHP_METHOD(HttpMessage, toString)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage___toString, 0, 0, 0)
+ZEND_END_ARG_INFO();
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_toString, 0, 0, 0)
+ ZEND_ARG_INFO(0, include_parent)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, toString)
{
zend_bool include_parent = 0;
RETURN_EMPTY_STRING();
}
-PHP_METHOD(HttpMessage, toStream)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_toStream, 0, 0, 1)
+ ZEND_ARG_INFO(0, stream)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, toStream)
{
zval *zstream;
}
}
-PHP_METHOD(HttpMessage, toCallback)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_toCallback, 0, 0, 1)
+ ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, toCallback)
{
php_http_pass_fcall_arg_t fcd;
RETURN_FALSE;
}
-PHP_METHOD(HttpMessage, serialize)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_serialize, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, serialize)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_EMPTY_STRING();
}
-PHP_METHOD(HttpMessage, unserialize)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, unserialize)
{
int length;
char *serialized;
}
}
-PHP_METHOD(HttpMessage, detach)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_detach, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, detach)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
} end_error_handling();
}
-PHP_METHOD(HttpMessage, prepend)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_prepend, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, message, http\\Message, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, prepend)
{
zval *prepend;
zend_bool top = 1;
}
}
-PHP_METHOD(HttpMessage, reverse)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_reverse, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, reverse)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_reverse(getThis(), return_value TSRMLS_CC);
}
}
-PHP_METHOD(HttpMessage, isMultipart)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_isMultipart, 0, 0, 0)
+ ZEND_ARG_INFO(1, boundary)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, isMultipart)
{
zval *zboundary = NULL;
}
}
-PHP_METHOD(HttpMessage, splitMultipartBody)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_splitMultipartBody, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, splitMultipartBody)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
}
}
-PHP_METHOD(HttpMessage, count)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_count, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, count)
{
if (SUCCESS == zend_parse_parameters_none()) {
long i = 0;
RETURN_FALSE;
}
-PHP_METHOD(HttpMessage, rewind)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_rewind, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, rewind)
{
if (SUCCESS == zend_parse_parameters_none()) {
zval *zobj = getThis();
}
}
-PHP_METHOD(HttpMessage, valid)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_valid, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, valid)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
}
}
-PHP_METHOD(HttpMessage, next)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_next, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, next)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
if (obj->iterator) {
php_http_message_object_t *itr = zend_object_store_get_object(obj->iterator TSRMLS_CC);
- if (itr && itr->parent.handle) {
+ if (itr && itr->parent) {
zval *old = obj->iterator;
MAKE_STD_ZVAL(obj->iterator);
- ZVAL_OBJVAL(obj->iterator, itr->parent, 1);
+ ZVAL_OBJVAL(obj->iterator, itr->parent->zv, 1);
zval_ptr_dtor(&old);
} else {
zval_ptr_dtor(&obj->iterator);
}
}
-PHP_METHOD(HttpMessage, key)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_key, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, key)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
}
}
-PHP_METHOD(HttpMessage, current)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_current, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(HttpMessage, current)
{
if (SUCCESS == zend_parse_parameters_none()) {
php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
}
}
+static zend_function_entry php_http_message_methods[] = {
+ PHP_ME(HttpMessage, __construct, ai_HttpMessage___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_ME(HttpMessage, getBody, ai_HttpMessage_getBody, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setBody, ai_HttpMessage_setBody, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, addBody, ai_HttpMessage_addBody, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getHeader, ai_HttpMessage_getHeader, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setHeader, ai_HttpMessage_setHeader, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, addHeader, ai_HttpMessage_addHeader, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getHeaders, ai_HttpMessage_getHeaders, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setHeaders, ai_HttpMessage_setHeaders, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, addHeaders, ai_HttpMessage_addHeaders, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getType, ai_HttpMessage_getType, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setType, ai_HttpMessage_setType, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getInfo, ai_HttpMessage_getInfo, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setInfo, ai_HttpMessage_setInfo, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getResponseCode, ai_HttpMessage_getResponseCode, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setResponseCode, ai_HttpMessage_setResponseCode, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getResponseStatus, ai_HttpMessage_getResponseStatus, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setResponseStatus, ai_HttpMessage_setResponseStatus, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getRequestMethod, ai_HttpMessage_getRequestMethod, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setRequestMethod, ai_HttpMessage_setRequestMethod, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getRequestUrl, ai_HttpMessage_getRequestUrl, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setRequestUrl, ai_HttpMessage_setRequestUrl, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getHttpVersion, ai_HttpMessage_getHttpVersion, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, setHttpVersion, ai_HttpMessage_setHttpVersion, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, getParentMessage, ai_HttpMessage_getParentMessage, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, toString, ai_HttpMessage_toString, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, toCallback, ai_HttpMessage_toCallback, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, toStream, ai_HttpMessage_toStream, ZEND_ACC_PUBLIC)
+
+ /* implements Countable */
+ PHP_ME(HttpMessage, count, ai_HttpMessage_count, ZEND_ACC_PUBLIC)
+
+ /* implements Serializable */
+ PHP_ME(HttpMessage, serialize, ai_HttpMessage_serialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, unserialize, ai_HttpMessage_unserialize, ZEND_ACC_PUBLIC)
+
+ /* implements Iterator */
+ PHP_ME(HttpMessage, rewind, ai_HttpMessage_rewind, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, valid, ai_HttpMessage_valid, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, current, ai_HttpMessage_current, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, key, ai_HttpMessage_key, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, next, ai_HttpMessage_next, ZEND_ACC_PUBLIC)
+
+ ZEND_MALIAS(HttpMessage, __toString, toString, ai_HttpMessage___toString, ZEND_ACC_PUBLIC)
+
+ PHP_ME(HttpMessage, detach, ai_HttpMessage_detach, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, prepend, ai_HttpMessage_prepend, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, reverse, ai_HttpMessage_reverse, ZEND_ACC_PUBLIC)
+
+ PHP_ME(HttpMessage, isMultipart, ai_HttpMessage_isMultipart, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessage, splitMultipartBody, ai_HttpMessage_splitMultipartBody, ZEND_ACC_PUBLIC)
+
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_message_class_entry;
+
+PHP_MINIT_FUNCTION(http_message)
+{
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http", "Message", php_http_message_methods);
+ php_http_message_class_entry = zend_register_internal_class_ex(&ce, php_http_object_class_entry, NULL TSRMLS_CC);
+ php_http_message_class_entry->create_object = php_http_message_object_new;
+ memcpy(&php_http_message_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_http_message_object_handlers.clone_obj = php_http_message_object_clone;
+ php_http_message_object_handlers.read_property = php_http_message_object_read_prop;
+ php_http_message_object_handlers.write_property = php_http_message_object_write_prop;
+ php_http_message_object_handlers.get_properties = php_http_message_object_get_props;
+ php_http_message_object_handlers.get_property_ptr_ptr = NULL;
+
+ zend_class_implements(php_http_message_class_entry TSRMLS_CC, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator);
+
+ zend_hash_init(&php_http_message_object_prophandlers, 9, NULL, NULL, 1);
+ zend_declare_property_long(php_http_message_class_entry, ZEND_STRL("type"), PHP_HTTP_NONE, ZEND_ACC_PROTECTED TSRMLS_CC);
+ php_http_message_object_add_prophandler(ZEND_STRL("type"), php_http_message_object_prophandler_get_type, php_http_message_object_prophandler_set_type);
+ zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("body"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ php_http_message_object_add_prophandler(ZEND_STRL("body"), php_http_message_object_prophandler_get_body, php_http_message_object_prophandler_set_body);
+ zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("requestMethod"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
+ php_http_message_object_add_prophandler(ZEND_STRL("requestMethod"), php_http_message_object_prophandler_get_request_method, php_http_message_object_prophandler_set_request_method);
+ zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("requestUrl"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
+ php_http_message_object_add_prophandler(ZEND_STRL("requestUrl"), php_http_message_object_prophandler_get_request_url, php_http_message_object_prophandler_set_request_url);
+ zend_declare_property_string(php_http_message_class_entry, ZEND_STRL("responseStatus"), "", ZEND_ACC_PROTECTED TSRMLS_CC);
+ php_http_message_object_add_prophandler(ZEND_STRL("responseStatus"), php_http_message_object_prophandler_get_response_status, php_http_message_object_prophandler_set_response_status);
+ zend_declare_property_long(php_http_message_class_entry, ZEND_STRL("responseCode"), 0, ZEND_ACC_PROTECTED TSRMLS_CC);
+ php_http_message_object_add_prophandler(ZEND_STRL("responseCode"), php_http_message_object_prophandler_get_response_code, php_http_message_object_prophandler_set_response_code);
+ zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("httpVersion"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ php_http_message_object_add_prophandler(ZEND_STRL("httpVersion"), php_http_message_object_prophandler_get_http_version, php_http_message_object_prophandler_set_http_version);
+ zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("headers"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ php_http_message_object_add_prophandler(ZEND_STRL("headers"), php_http_message_object_prophandler_get_headers, php_http_message_object_prophandler_set_headers);
+ zend_declare_property_null(php_http_message_class_entry, ZEND_STRL("parentMessage"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ php_http_message_object_add_prophandler(ZEND_STRL("parentMessage"), php_http_message_object_prophandler_get_parent_message, php_http_message_object_prophandler_set_parent_message);
+
+ zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_NONE"), PHP_HTTP_NONE TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_REQUEST"), PHP_HTTP_REQUEST TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_message_class_entry, ZEND_STRL("TYPE_RESPONSE"), PHP_HTTP_RESPONSE TSRMLS_CC);
+
+ return SUCCESS;
+}
+
+PHP_MSHUTDOWN_FUNCTION(http_message)
+{
+ zend_hash_destroy(&php_http_message_object_prophandlers);
+
+ return SUCCESS;
+}
+
/*
* Local variables:
* tab-width: 4
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
PHP_HTTP_API php_http_message_t *php_http_message_parse(php_http_message_t *msg, const char *str, size_t len, zend_bool greedy TSRMLS_DC);
-/* PHP */
-
typedef struct php_http_message_object {
zend_object zo;
zend_object_value zv;
php_http_message_t *message;
- zend_object_value parent, body;
+ struct php_http_message_object *parent;
+ php_http_message_body_object_t *body;
zval *iterator;
} php_http_message_object_t;
-zend_class_entry *php_http_message_get_class_entry(void);
+zend_class_entry *php_http_message_class_entry;
PHP_MINIT_FUNCTION(http_message);
PHP_MSHUTDOWN_FUNCTION(http_message);
zend_object_value php_http_message_object_clone(zval *object TSRMLS_DC);
void php_http_message_object_free(void *object TSRMLS_DC);
-PHP_METHOD(HttpMessage, __construct);
-PHP_METHOD(HttpMessage, getBody);
-PHP_METHOD(HttpMessage, setBody);
-PHP_METHOD(HttpMessage, addBody);
-PHP_METHOD(HttpMessage, getHeader);
-PHP_METHOD(HttpMessage, setHeader);
-PHP_METHOD(HttpMessage, addHeader);
-PHP_METHOD(HttpMessage, getHeaders);
-PHP_METHOD(HttpMessage, setHeaders);
-PHP_METHOD(HttpMessage, addHeaders);
-PHP_METHOD(HttpMessage, getType);
-PHP_METHOD(HttpMessage, setType);
-PHP_METHOD(HttpMessage, getInfo);
-PHP_METHOD(HttpMessage, setInfo);
-PHP_METHOD(HttpMessage, getResponseCode);
-PHP_METHOD(HttpMessage, setResponseCode);
-PHP_METHOD(HttpMessage, getResponseStatus);
-PHP_METHOD(HttpMessage, setResponseStatus);
-PHP_METHOD(HttpMessage, getRequestMethod);
-PHP_METHOD(HttpMessage, setRequestMethod);
-PHP_METHOD(HttpMessage, getRequestUrl);
-PHP_METHOD(HttpMessage, setRequestUrl);
-PHP_METHOD(HttpMessage, getHttpVersion);
-PHP_METHOD(HttpMessage, setHttpVersion);
-PHP_METHOD(HttpMessage, guessContentType);
-PHP_METHOD(HttpMessage, getParentMessage);
-PHP_METHOD(HttpMessage, send);
-PHP_METHOD(HttpMessage, toString);
-PHP_METHOD(HttpMessage, toStream);
-PHP_METHOD(HttpMessage, toCallback);
-
-PHP_METHOD(HttpMessage, count);
-PHP_METHOD(HttpMessage, serialize);
-PHP_METHOD(HttpMessage, unserialize);
-PHP_METHOD(HttpMessage, rewind);
-PHP_METHOD(HttpMessage, valid);
-PHP_METHOD(HttpMessage, current);
-PHP_METHOD(HttpMessage, key);
-PHP_METHOD(HttpMessage, next);
-
-PHP_METHOD(HttpMessage, factory);
-
-PHP_METHOD(HttpMessage, detach);
-PHP_METHOD(HttpMessage, prepend);
-PHP_METHOD(HttpMessage, reverse);
-
-PHP_METHOD(HttpMessage, isMultipart);
-PHP_METHOD(HttpMessage, splitMultipartBody);
#endif
/*
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
return msg;
}
-/* PHP */
-
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpMessageBody, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpMessageBody, method, 0)
-#define PHP_HTTP_MESSAGE_BODY_ME(method, visibility) PHP_ME(HttpMessageBody, method, PHP_HTTP_ARGS(HttpMessageBody, method), visibility)
-
-PHP_HTTP_BEGIN_ARGS(__construct, 0)
- PHP_HTTP_ARG_VAL(stream, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(__toString);
-PHP_HTTP_BEGIN_ARGS(unserialize, 1)
- PHP_HTTP_ARG_VAL(serialized, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(toStream, 1)
- PHP_HTTP_ARG_VAL(stream, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(toCallback, 1)
- PHP_HTTP_ARG_VAL(callback, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getResource);
-
-PHP_HTTP_BEGIN_ARGS(append, 1)
- PHP_HTTP_ARG_VAL(string, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(addForm, 0)
- PHP_HTTP_ARG_ARR(fields, 1, 0)
- PHP_HTTP_ARG_ARR(files, 1, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(addPart, 1)
- PHP_HTTP_ARG_OBJ(http\\Message, message, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(etag);
-
-PHP_HTTP_BEGIN_ARGS(stat, 0)
- PHP_HTTP_ARG_VAL(what, 0)
-PHP_HTTP_END_ARGS;
-
-static zend_class_entry *php_http_message_body_class_entry;
-
-zend_class_entry *php_http_message_body_get_class_entry(void)
-{
- return php_http_message_body_class_entry;
-}
-
-static zend_function_entry php_http_message_body_method_entry[] = {
- PHP_HTTP_MESSAGE_BODY_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_HTTP_MESSAGE_BODY_ME(__toString, ZEND_ACC_PUBLIC)
- PHP_MALIAS(HttpMessageBody, toString, __toString, args_for_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
- PHP_MALIAS(HttpMessageBody, serialize, __toString, args_for_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_BODY_ME(unserialize, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_BODY_ME(toStream, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_BODY_ME(toCallback, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_BODY_ME(getResource, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_BODY_ME(append, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_BODY_ME(addForm, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_BODY_ME(addPart, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_BODY_ME(etag, ZEND_ACC_PUBLIC)
- PHP_HTTP_MESSAGE_BODY_ME(stat, ZEND_ACC_PUBLIC)
- EMPTY_FUNCTION_ENTRY
-};
static zend_object_handlers php_http_message_body_object_handlers;
-PHP_MINIT_FUNCTION(http_message_body)
-{
- PHP_HTTP_REGISTER_CLASS(http\\Message, Body, http_message_body, php_http_object_get_class_entry(), 0);
- php_http_message_body_class_entry->create_object = php_http_message_body_object_new;
- memcpy(&php_http_message_body_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_http_message_body_object_handlers.clone_obj = php_http_message_body_object_clone;
- zend_class_implements(php_http_message_body_class_entry TSRMLS_CC, 1, zend_ce_serializable);
- return SUCCESS;
-}
-
zend_object_value php_http_message_body_object_new(zend_class_entry *ce TSRMLS_DC)
{
return php_http_message_body_object_new_ex(ce, NULL, NULL TSRMLS_CC);
zend_object_value php_http_message_body_object_new_ex(zend_class_entry *ce, php_http_message_body_t *body, php_http_message_body_object_t **ptr TSRMLS_DC)
{
- zend_object_value ov;
php_http_message_body_object_t *o;
o = ecalloc(1, sizeof(php_http_message_body_object_t));
o->body = body;
}
- ov.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_message_body_object_free, NULL TSRMLS_CC);
- ov.handlers = &php_http_message_body_object_handlers;
+ o->zv.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_message_body_object_free, NULL TSRMLS_CC);
+ o->zv.handlers = &php_http_message_body_object_handlers;
- return ov;
+ return o->zv;
}
zend_object_value php_http_message_body_object_clone(zval *object TSRMLS_DC)
{
php_http_message_body_object_t *obj = object;
- if (!obj->shared) {
- php_http_message_body_free(&obj->body);
- }
+ php_http_message_body_free(&obj->body);
zend_object_std_dtor((zend_object *) obj TSRMLS_CC);
efree(obj);
}
} \
} while(0)
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, stream)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, __construct)
{
php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
zval *zstream = NULL;
php_stream *stream;
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r!", &zstream)) {
if (zstream) {
php_stream_from_zval(stream, &zstream);
} end_error_handling();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody___toString, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, __toString)
{
if (SUCCESS == zend_parse_parameters_none()) {
RETURN_EMPTY_STRING();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, unserialize)
{
char *us_str;
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_toStream, 0, 0, 1)
+ ZEND_ARG_INFO(0, stream)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, toStream)
{
zval *zstream;
RETURN_FALSE;
}
-
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_toCallback, 0, 0, 1)
+ ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, toCallback)
{
php_http_pass_fcall_arg_t fcd;
RETURN_FALSE;
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_getResource, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, getResource)
{
if (SUCCESS == zend_parse_parameters_none()) {
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_append, 0, 0, 1)
+ ZEND_ARG_INFO(0, string)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, append)
{
char *str;
RETURN_FALSE;
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_addForm, 0, 0, 0)
+ ZEND_ARG_ARRAY_INFO(0, fields, 1)
+ ZEND_ARG_ARRAY_INFO(0, files, 1)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, addForm)
{
HashTable *fields = NULL, *files = NULL;
PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj);
- RETURN_SUCCESS(php_http_message_body_add_form(obj->body, fields, files));
+ RETURN_BOOL(SUCCESS == php_http_message_body_add_form(obj->body, fields, files));
}
RETURN_FALSE;
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_addPart, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, message, http\\Message, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, addPart)
{
zval *zobj;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zobj, php_http_message_get_class_entry())) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zobj, php_http_message_class_entry)) {
php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
php_http_message_object_t *mobj = zend_object_store_get_object(zobj TSRMLS_CC);
RETURN_FALSE;
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_etag, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, etag)
{
if (SUCCESS == zend_parse_parameters_none()) {
RETURN_FALSE;
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_stat, 0, 0, 0)
+ ZEND_ARG_INFO(0, what)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpMessageBody, stat)
{
char *field_str = NULL;
RETURN_FALSE;
}
+static zend_function_entry php_http_message_body_methods[] = {
+ PHP_ME(HttpMessageBody, __construct, ai_HttpMessageBody___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_ME(HttpMessageBody, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
+ PHP_MALIAS(HttpMessageBody, toString, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
+ PHP_MALIAS(HttpMessageBody, serialize, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, unserialize, ai_HttpMessageBody_unserialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, toStream, ai_HttpMessageBody_toStream, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, toCallback, ai_HttpMessageBody_toCallback, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, getResource, ai_HttpMessageBody_getResource, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, append, ai_HttpMessageBody_append, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, addForm, ai_HttpMessageBody_addForm, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, addPart, ai_HttpMessageBody_addPart, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, etag, ai_HttpMessageBody_etag, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpMessageBody, stat, ai_HttpMessageBody_stat, ZEND_ACC_PUBLIC)
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_message_body_class_entry;
+
+PHP_MINIT_FUNCTION(http_message_body)
+{
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http\\Message", "Body", php_http_message_body_methods);
+ php_http_message_body_class_entry = zend_register_internal_class_ex(&ce, php_http_object_class_entry, NULL TSRMLS_CC);
+ php_http_message_body_class_entry->create_object = php_http_message_body_object_new;
+ memcpy(&php_http_message_body_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_http_message_body_object_handlers.clone_obj = php_http_message_body_object_clone;
+ zend_class_implements(php_http_message_body_class_entry TSRMLS_CC, 1, zend_ce_serializable);
+
+ return SUCCESS;
+}
+
/*
* Local variables:
* tab-width: 4
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
return zend_fetch_resource(NULL TSRMLS_CC, body->stream_id, "stream", NULL, 2, php_file_le_stream(), php_file_le_pstream());
}
-
typedef struct php_http_message_body_object {
zend_object zo;
+ zend_object_value zv;
php_http_message_body_t *body;
- unsigned shared:1;
} php_http_message_body_object_t;
-zend_class_entry *php_http_message_body_get_class_entry(void);
-
+PHP_HTTP_API zend_class_entry *php_http_message_body_class_entry;
PHP_MINIT_FUNCTION(http_message_body);
zend_object_value php_http_message_body_object_new(zend_class_entry *ce TSRMLS_DC);
zend_object_value php_http_message_body_object_clone(zval *object TSRMLS_DC);
void php_http_message_body_object_free(void *object TSRMLS_DC);
-PHP_METHOD(HttpMessageBody, __construct);
-PHP_METHOD(HttpMessageBody, __toString);
-PHP_METHOD(HttpMessageBody, unserialize);
-PHP_METHOD(HttpMessageBody, getResource);
-PHP_METHOD(HttpMessageBody, toStream);
-PHP_METHOD(HttpMessageBody, toCallback);
-PHP_METHOD(HttpMessageBody, append);
-PHP_METHOD(HttpMessageBody, addForm);
-PHP_METHOD(HttpMessageBody, addPart);
-PHP_METHOD(HttpMessageBody, etag);
-PHP_METHOD(HttpMessageBody, stat);
-
#endif
/*
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
return EH_THROW;
}
- if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), php_http_object_get_class_entry() TSRMLS_CC)) {
+ if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), php_http_object_class_entry TSRMLS_CC)) {
return php_http_object_get_error_handling(EG(This) TSRMLS_CC);
}
switch (scope_error_handling(type TSRMLS_CC)) {
case EH_THROW: {
char *message;
- zend_class_entry *ce = php_http_exception_get_class_entry();
+ zend_class_entry *ce = php_http_exception_class_entry;
/* FIXME wat? */
if (0&& EG(exception_class) && instanceof_function(EG(exception_class), ce TSRMLS_CC)) {
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
/* CR LF */
#define PHP_HTTP_CRLF "\r\n"
-/* max URL length */
-#define PHP_HTTP_URL_MAXLEN 4096
-
/* def URL arg separator */
#define PHP_HTTP_URL_ARGSEP "&"
STATUS php_http_method_call(zval *object, const char *method_str, size_t method_len, int argc, zval **argv[], zval **retval_ptr TSRMLS_DC);
-/* return bool (v == SUCCESS) */
-#define RETVAL_SUCCESS(v) RETVAL_BOOL(SUCCESS == (v))
-#define RETURN_SUCCESS(v) RETURN_BOOL(SUCCESS == (v))
/* return object(values) */
#define RETVAL_OBJECT(o, addref) \
RETVAL_OBJVAL((o)->value.obj, addref)
if (addref && Z_OBJ_HT_P(zv)->add_ref) { \
Z_OBJ_HT_P(zv)->add_ref((zv) TSRMLS_CC); \
}
-/* return property */
-#define RETVAL_PROP(CE, n) RETVAL_PROP_EX(CE, getThis(), n)
-#define RETURN_PROP(CE, n) RETURN_PROP_EX(CE, getThis(), n)
-#define RETVAL_PROP_EX(CE, this, n) \
- { \
- zval *__prop = zend_read_property(CE, this, ZEND_STRL(n), 0 TSRMLS_CC); \
- RETVAL_ZVAL(__prop, 1, 0); \
- }
-#define RETURN_PROP_EX(CE, this, n) \
- { \
- zval *__prop = zend_read_property(CE, this, ZEND_STRL(n), 0 TSRMLS_CC); \
- RETURN_ZVAL(__prop, 1, 0); \
- }
-#define RETVAL_SPROP(CE, n) \
- { \
- zval *__prop = zend_read_static_property(CE, ZEND_STRL(n), 0 TSRMLS_CC); \
- RETVAL_ZVAL(__prop, 1, 0); \
- }
-#define RETURN_SPROP(CE, n) \
- { \
- zval *__prop = zend_read_static_property(CE, ZEND_STRL(n), 0 TSRMLS_CC); \
- RETURN_ZVAL(__prop, 1, 0); \
- }
#define Z_OBJ_DELREF(z) \
if (Z_OBJ_HT(z)->del_ref) { \
Z_OBJ_HT_PP(z)->add_ref(*(z) TSRMLS_CC); \
}
-#define PHP_HTTP_BEGIN_ARGS_EX(class, method, ret_ref, req_args) ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 0, ret_ref, req_args)
-#define PHP_HTTP_BEGIN_ARGS_AR(class, method, ret_ref, req_args) ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 1, ret_ref, req_args)
-#define PHP_HTTP_END_ARGS }
-#define PHP_HTTP_EMPTY_ARGS_EX(class, method, ret_ref) PHP_HTTP_BEGIN_ARGS_EX(class, method, ret_ref, 0) PHP_HTTP_END_ARGS
-#define PHP_HTTP_ARGS(class, method) args_for_ ##class## _ ##method
-#define PHP_HTTP_ARG_VAL(name, pass_ref) ZEND_ARG_INFO(pass_ref, name)
-#define PHP_HTTP_ARG_OBJ(class, name, allow_null) ZEND_ARG_OBJ_INFO(0, name, class, allow_null)
-#define PHP_HTTP_ARG_ARR(name, allow_null, pass_ref) ZEND_ARG_ARRAY_INFO(pass_ref, name, allow_null)
-
#define EMPTY_FUNCTION_ENTRY {NULL, NULL, NULL, 0, 0}
#define PHP_MINIT_CALL(func) PHP_MINIT(func)(INIT_FUNC_ARGS_PASSTHRU)
#define PHP_MSHUTDOWN_CALL(func) PHP_MSHUTDOWN(func)(SHUTDOWN_FUNC_ARGS_PASSTHRU)
#define PHP_RSHUTDOWN_CALL(func) PHP_RSHUTDOWN(func)(SHUTDOWN_FUNC_ARGS_PASSTHRU)
-
-#define PHP_HTTP_INI_ENTRY(entry, default, scope, updater, global) \
- STD_PHP_INI_ENTRY(entry, default, scope, updater, global, zend_php_http_globals, php_http_globals)
-#define PHP_HTTP_INI_ENTRY_EX(entry, default, scope, updater, displayer, global) \
- STD_PHP_INI_ENTRY_EX(entry, default, scope, updater, global, zend_php_http_globals, php_http_globals, displayer)
-
-#define PHP_HTTP_REGISTER_CLASS(ns, classname, name, parent, flags) \
- { \
- zend_class_entry ce; \
- memset(&ce, 0, sizeof(zend_class_entry)); \
- INIT_NS_CLASS_ENTRY(ce, #ns, #classname, php_ ##name## _method_entry); \
- php_ ##name## _class_entry = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
- php_ ##name## _class_entry->ce_flags |= flags; \
- php_http_register_class(php_ ##name## _get_class_entry); \
- }
-
-#define PHP_HTTP_REGISTER_INTERFACE(ns, ifacename, name, flags) \
- { \
- zend_class_entry ce; \
- memset(&ce, 0, sizeof(zend_class_entry)); \
- INIT_NS_CLASS_ENTRY(ce, #ns, #ifacename, php_ ##name## _method_entry); \
- php_ ##name## _class_entry = zend_register_internal_interface(&ce TSRMLS_CC); \
- php_ ##name## _class_entry->ce_flags |= flags; \
- php_http_register_class(php_ ##name## _get_class_entry); \
- }
-
-#define PHP_HTTP_REGISTER_EXCEPTION(classname, cename, parent) \
- { \
- zend_class_entry ce; \
- memset(&ce, 0, sizeof(zend_class_entry)); \
- INIT_NS_CLASS_ENTRY(ce, "http", #classname, NULL); \
- ce.create_object = NULL; \
- cename = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \
- }
-
/* ARRAYS */
PHP_HTTP_API unsigned php_http_array_list(HashTable *ht TSRMLS_DC, unsigned argc, ...);
} php_http_error_t;
#endif
+
/*
* Local variables:
* tab-width: 4
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#include "php_http_api.h"
-PHP_HTTP_API STATUS php_http_new(zend_object_value *ov, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC)
+PHP_HTTP_API STATUS php_http_new(zend_object_value *ovp, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC)
{
+ zend_object_value ov;
+
if (!ce) {
ce = parent_ce;
} else if (parent_ce && !instanceof_function(ce, parent_ce TSRMLS_CC)) {
return FAILURE;
}
- *ov = create(ce, intern_ptr, obj_ptr TSRMLS_CC);
+ ov = create(ce, intern_ptr, obj_ptr TSRMLS_CC);
+ if (ovp) {
+ *ovp = ov;
+ }
return SUCCESS;
}
zval_ptr_dtor(&lzeh);
return eh;
}
- zeh = zend_read_static_property(php_http_object_get_class_entry(), ZEND_STRL("defaultErrorHandling"), 0 TSRMLS_CC);
+ zeh = zend_read_static_property(php_http_object_class_entry, ZEND_STRL("defaultErrorHandling"), 0 TSRMLS_CC);
if (Z_TYPE_P(zeh) != IS_NULL) {
lzeh = php_http_ztyp(IS_LONG, zeh);
eh = Z_LVAL_P(lzeh);
return EH_NORMAL;
}
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpObject, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpObject, method, 0)
-#define PHP_HTTP_OBJECT_ME(method, visibility) PHP_ME(HttpObject, method, PHP_HTTP_ARGS(HttpObject, method), visibility)
-
-PHP_HTTP_BEGIN_ARGS(setErrorHandling, 1)
- PHP_HTTP_ARG_VAL(eh, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getErrorHandling);
-
-PHP_HTTP_BEGIN_ARGS(setDefaultErrorHandling, 1)
- PHP_HTTP_ARG_VAL(eh, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getDefaultErrorHandling);
-
-PHP_HTTP_BEGIN_ARGS(triggerError, 3)
- PHP_HTTP_ARG_VAL(error_type, 0)
- PHP_HTTP_ARG_VAL(error_code, 0)
- PHP_HTTP_ARG_VAL(error_message, 0)
-PHP_HTTP_END_ARGS;
-
-static zend_class_entry *php_http_object_class_entry;
-
-zend_class_entry *php_http_object_get_class_entry(void)
-{
- return php_http_object_class_entry;
-}
-
-static zend_function_entry php_http_object_method_entry[] = {
- PHP_HTTP_OBJECT_ME(setErrorHandling, ZEND_ACC_PUBLIC)
- PHP_HTTP_OBJECT_ME(getErrorHandling, ZEND_ACC_PUBLIC)
- PHP_HTTP_OBJECT_ME(setDefaultErrorHandling, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_HTTP_OBJECT_ME(getDefaultErrorHandling, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
- PHP_HTTP_OBJECT_ME(triggerError, ZEND_ACC_PUBLIC)
-
- EMPTY_FUNCTION_ENTRY
-};
-
zend_object_value php_http_object_new(zend_class_entry *ce TSRMLS_DC)
{
return php_http_object_new_ex(ce, NULL, NULL TSRMLS_CC);
zend_object_value php_http_object_new_ex(zend_class_entry *ce, void *nothing, php_http_object_t **ptr TSRMLS_DC)
{
- zend_object_value ov;
php_http_object_t *o;
o = ecalloc(1, sizeof(php_http_object_t));
*ptr = o;
}
- ov.handle = zend_objects_store_put(o, NULL, (zend_objects_free_object_storage_t) zend_objects_free_object_storage, NULL TSRMLS_CC);
- ov.handlers = zend_get_std_object_handlers();
+ o->zv.handle = zend_objects_store_put(o, NULL, (zend_objects_free_object_storage_t) zend_objects_free_object_storage, NULL TSRMLS_CC);
+ o->zv.handlers = zend_get_std_object_handlers();
- return ov;
+ return o->zv;
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpObject_getErrorHandling, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpObject, getErrorHandling)
{
- RETURN_PROP(php_http_object_get_class_entry(), "errorHandling");
+ zval *zeh = zend_read_property(php_http_object_class_entry, getThis(), ZEND_STRL("errorHandling"), 0 TSRMLS_CC);
+ RETURN_ZVAL(zeh, 1, 0);
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpObject_setErrorHandling, 0, 0, 1)
+ ZEND_ARG_INFO(0, eh)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpObject, setErrorHandling)
{
long eh;
case EH_NORMAL:
case EH_SUPPRESS:
case EH_THROW:
- zend_update_property_long(php_http_object_get_class_entry(), getThis(), ZEND_STRL("errorHandling"), eh TSRMLS_CC);
+ zend_update_property_long(php_http_object_class_entry, getThis(), ZEND_STRL("errorHandling"), eh TSRMLS_CC);
break;
default:
RETURN_ZVAL(getThis(), 1, 0);
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpObject_getDefaultErrorHandling, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpObject, getDefaultErrorHandling)
{
- RETURN_SPROP(php_http_object_get_class_entry(), "defaultErrorHandling");
+ zval *zdeh = zend_read_static_property(php_http_object_class_entry, ZEND_STRL("defaultErrorHandling"), 0 TSRMLS_CC);
+ RETURN_ZVAL(zdeh, 1, 0);
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpObject_setDefaultErrorHandling, 0, 0, 1)
+ ZEND_ARG_INFO(0, eh)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpObject, setDefaultErrorHandling)
{
long eh;
case EH_NORMAL:
case EH_SUPPRESS:
case EH_THROW:
- zend_update_static_property_long(php_http_object_get_class_entry(), ZEND_STRL("defaultErrorHandling"), eh TSRMLS_CC);
+ zend_update_static_property_long(php_http_object_class_entry, ZEND_STRL("defaultErrorHandling"), eh TSRMLS_CC);
break;
default:
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpObject_triggerError, 0, 0, 3)
+ ZEND_ARG_INFO(0, error_type)
+ ZEND_ARG_INFO(0, error_code)
+ ZEND_ARG_INFO(0, error_message)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpObject, triggerError)
{
long eh, code;
}
}
+static zend_function_entry php_http_object_methods[] = {
+ PHP_ME(HttpObject, setErrorHandling, ai_HttpObject_setErrorHandling, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpObject, getErrorHandling, ai_HttpObject_getErrorHandling, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpObject, setDefaultErrorHandling, ai_HttpObject_setDefaultErrorHandling, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpObject, getDefaultErrorHandling, ai_HttpObject_getDefaultErrorHandling, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ PHP_ME(HttpObject, triggerError, ai_HttpObject_triggerError, ZEND_ACC_PUBLIC)
+
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_object_class_entry;
+
PHP_MINIT_FUNCTION(http_object)
{
- PHP_HTTP_REGISTER_CLASS(http, Object, http_object, NULL, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
- php_http_object_get_class_entry()->create_object = php_http_object_new;
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http", "Object", php_http_object_methods);
+ php_http_object_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL TSRMLS_CC);
+ php_http_object_class_entry->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
+ php_http_object_class_entry->create_object = php_http_object_new;
- zend_declare_property_null(php_http_object_get_class_entry(), ZEND_STRL("defaultErrorHandling"), (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC);
- zend_declare_property_null(php_http_object_get_class_entry(), ZEND_STRL("errorHandling"), ZEND_ACC_PROTECTED TSRMLS_CC);
+ zend_declare_property_null(php_http_object_class_entry, ZEND_STRL("defaultErrorHandling"), (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC);
+ zend_declare_property_null(php_http_object_class_entry, ZEND_STRL("errorHandling"), ZEND_ACC_PROTECTED TSRMLS_CC);
- zend_declare_class_constant_long(php_http_object_get_class_entry(), ZEND_STRL("EH_NORMAL"), EH_NORMAL TSRMLS_CC);
- zend_declare_class_constant_long(php_http_object_get_class_entry(), ZEND_STRL("EH_SUPPRESS"), EH_SUPPRESS TSRMLS_CC);
- zend_declare_class_constant_long(php_http_object_get_class_entry(), ZEND_STRL("EH_THROW"), EH_THROW TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_object_class_entry, ZEND_STRL("EH_NORMAL"), EH_NORMAL TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_object_class_entry, ZEND_STRL("EH_SUPPRESS"), EH_SUPPRESS TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_object_class_entry, ZEND_STRL("EH_THROW"), EH_THROW TSRMLS_CC);
return SUCCESS;
}
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
typedef struct php_http_object {
zend_object zo;
+ zend_object_value zv;
} php_http_object_t;
-zend_class_entry *php_http_object_get_class_entry(void);
-
+PHP_HTTP_API zend_class_entry *php_http_object_class_entry;
PHP_MINIT_FUNCTION(http_object);
zend_object_value php_http_object_new(zend_class_entry *ce TSRMLS_DC);
PHP_HTTP_API zend_error_handling_t php_http_object_get_error_handling(zval *object TSRMLS_DC);
-PHP_METHOD(HttpObject, setErrorHandling);
-PHP_METHOD(HttpObject, getErrorHandling);
-PHP_METHOD(HttpObject, setDefaultErrorHandling);
-PHP_METHOD(HttpObject, getDefaultErrorHandling);
-PHP_METHOD(HttpObject, triggerError);
-
#endif
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
return buf;
}
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpParams, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpParams, method, 0)
-#define PHP_HTTP_PARAMS_ME(method, visibility) PHP_ME(HttpParams, method, PHP_HTTP_ARGS(HttpParams, method), visibility)
-#define PHP_HTTP_PARAMS_GME(method, visibility) PHP_ME(HttpParams, method, PHP_HTTP_ARGS(HttpParams, __getter), visibility)
-
-PHP_HTTP_BEGIN_ARGS(__construct, 0)
- PHP_HTTP_ARG_VAL(params, 0)
- PHP_HTTP_ARG_VAL(param_sep, 0)
- PHP_HTTP_ARG_VAL(arg_sep, 0)
- PHP_HTTP_ARG_VAL(val_sep, 0)
- PHP_HTTP_ARG_VAL(flags, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(toArray);
-PHP_HTTP_EMPTY_ARGS(toString);
-
-PHP_HTTP_BEGIN_ARGS(offsetExists, 1)
- PHP_HTTP_ARG_VAL(name, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(offsetUnset, 1)
- PHP_HTTP_ARG_VAL(name, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(offsetGet, 1)
- PHP_HTTP_ARG_VAL(name, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(offsetSet, 2)
- PHP_HTTP_ARG_VAL(name, 0)
- PHP_HTTP_ARG_VAL(value, 0)
-PHP_HTTP_END_ARGS;
-
-static zend_class_entry *php_http_params_class_entry;
-
-zend_class_entry *php_http_params_get_class_entry(void)
-{
- return php_http_params_class_entry;
-}
-
-static zend_function_entry php_http_params_method_entry[] = {
- PHP_HTTP_PARAMS_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR|ZEND_ACC_FINAL)
-
- PHP_HTTP_PARAMS_ME(toArray, ZEND_ACC_PUBLIC)
- PHP_HTTP_PARAMS_ME(toString, ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpParams, __toString, toString, PHP_HTTP_ARGS(HttpParams, toString), ZEND_ACC_PUBLIC)
-
- PHP_HTTP_PARAMS_ME(offsetExists, ZEND_ACC_PUBLIC)
- PHP_HTTP_PARAMS_ME(offsetUnset, ZEND_ACC_PUBLIC)
- PHP_HTTP_PARAMS_ME(offsetSet, ZEND_ACC_PUBLIC)
- PHP_HTTP_PARAMS_ME(offsetGet, ZEND_ACC_PUBLIC)
-
- EMPTY_FUNCTION_ENTRY
-};
-
-PHP_MINIT_FUNCTION(http_params)
-{
- PHP_HTTP_REGISTER_CLASS(http, Params, http_params, php_http_object_get_class_entry(), 0);
-
- zend_class_implements(php_http_params_class_entry TSRMLS_CC, 1, zend_ce_arrayaccess);
-
- zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_PARAM_SEP"), ZEND_STRL(",") TSRMLS_CC);
- zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_ARG_SEP"), ZEND_STRL(";") TSRMLS_CC);
- zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_VAL_SEP"), ZEND_STRL("=") TSRMLS_CC);
- zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("COOKIE_PARAM_SEP"), ZEND_STRL("") TSRMLS_CC);
-
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_RAW"), PHP_HTTP_PARAMS_RAW TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_DEFAULT"), PHP_HTTP_PARAMS_DEFAULT TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_URLENCODED"), PHP_HTTP_PARAMS_URLENCODED TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_DIMENSION"), PHP_HTTP_PARAMS_DIMENSION TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_QUERY"), PHP_HTTP_PARAMS_QUERY TSRMLS_CC);
-
- zend_declare_property_null(php_http_params_class_entry, ZEND_STRL("params"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("param_sep"), ZEND_STRL(","), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("arg_sep"), ZEND_STRL(";"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("val_sep"), ZEND_STRL("="), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_long(php_http_params_class_entry, ZEND_STRL("flags"), PHP_HTTP_PARAMS_DEFAULT, ZEND_ACC_PUBLIC TSRMLS_CC);
-
- return SUCCESS;
-}
-
PHP_HTTP_API php_http_params_token_t **php_http_params_separator_init(zval *zv TSRMLS_DC)
{
zval **sep;
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, params)
+ ZEND_ARG_INFO(0, param_sep)
+ ZEND_ARG_INFO(0, arg_sep)
+ ZEND_ARG_INFO(0, val_sep)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpParams, __construct)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
zval *zcopy, *zparams = NULL, *param_sep = NULL, *arg_sep = NULL, *val_sep = NULL;
long flags = PHP_HTTP_PARAMS_DEFAULT;
} end_error_handling();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_toArray, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpParams, toArray)
{
- if (SUCCESS != zend_parse_parameters_none()) {
- RETURN_FALSE;
+ if (SUCCESS == zend_parse_parameters_none()) {
+ zval *zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0 TSRMLS_CC);
+ RETURN_ZVAL(zparams, 1, 0);
}
- RETURN_PROP(php_http_params_class_entry, "params");
+ RETURN_FALSE;
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_toString, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpParams, toString)
{
zval **tmp, *zparams, *zpsep, *zasep, *zvsep, *zflags;
RETVAL_PHP_HTTP_BUFFER_VAL(&buf);
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetExists, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpParams, offsetExists)
{
char *name_str;
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetGet, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpParams, offsetGet)
{
char *name_str;
}
}
-
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetUnset, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpParams, offsetUnset)
{
char *name_str;
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetSet, 0, 0, 2)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpParams, offsetSet)
{
zval *nvalue;
}
}
+static zend_function_entry php_http_params_methods[] = {
+ PHP_ME(HttpParams, __construct, ai_HttpParams___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR|ZEND_ACC_FINAL)
+
+ PHP_ME(HttpParams, toArray, ai_HttpParams_toArray, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpParams, toString, ai_HttpParams_toString, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpParams, __toString, toString, ai_HttpParams_toString, ZEND_ACC_PUBLIC)
+
+ PHP_ME(HttpParams, offsetExists, ai_HttpParams_offsetExists, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpParams, offsetUnset, ai_HttpParams_offsetUnset, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpParams, offsetSet, ai_HttpParams_offsetSet, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpParams, offsetGet, ai_HttpParams_offsetGet, ZEND_ACC_PUBLIC)
+
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_params_class_entry;
+
+PHP_MINIT_FUNCTION(http_params)
+{
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http", "Params", php_http_params_methods);
+ php_http_params_class_entry = zend_register_internal_class_ex(&ce, php_http_object_class_entry, NULL TSRMLS_CC);
+ zend_class_implements(php_http_params_class_entry TSRMLS_CC, 1, zend_ce_arrayaccess);
+
+ zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_PARAM_SEP"), ZEND_STRL(",") TSRMLS_CC);
+ zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_ARG_SEP"), ZEND_STRL(";") TSRMLS_CC);
+ zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_VAL_SEP"), ZEND_STRL("=") TSRMLS_CC);
+ zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("COOKIE_PARAM_SEP"), ZEND_STRL("") TSRMLS_CC);
+
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_RAW"), PHP_HTTP_PARAMS_RAW TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_DEFAULT"), PHP_HTTP_PARAMS_DEFAULT TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_URLENCODED"), PHP_HTTP_PARAMS_URLENCODED TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_DIMENSION"), PHP_HTTP_PARAMS_DIMENSION TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_QUERY"), PHP_HTTP_PARAMS_QUERY TSRMLS_CC);
+
+ zend_declare_property_null(php_http_params_class_entry, ZEND_STRL("params"), ZEND_ACC_PUBLIC TSRMLS_CC);
+ zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("param_sep"), ZEND_STRL(","), ZEND_ACC_PUBLIC TSRMLS_CC);
+ zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("arg_sep"), ZEND_STRL(";"), ZEND_ACC_PUBLIC TSRMLS_CC);
+ zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("val_sep"), ZEND_STRL("="), ZEND_ACC_PUBLIC TSRMLS_CC);
+ zend_declare_property_long(php_http_params_class_entry, ZEND_STRL("flags"), PHP_HTTP_PARAMS_DEFAULT, ZEND_ACC_PUBLIC TSRMLS_CC);
+
+ return SUCCESS;
+}
+
/*
* Local variables:
* tab-width: 4
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#define PHP_HTTP_PARAMS_DEFAULT 0x01
#define PHP_HTTP_PARAMS_URLENCODED 0x04
#define PHP_HTTP_PARAMS_DIMENSION 0x08
-#define PHP_HTTP_PARAMS_QUERY (PHP_HTTP_PARAMS_URLENCODED|PHP_HTTP_PARAMS_DIMENSION)
+#define PHP_HTTP_PARAMS_QUERY (PHP_HTTP_PARAMS_URLENCODED|PHP_HTTP_PARAMS_DIMENSION)
typedef struct php_http_params_opts {
php_http_params_token_t input;
typedef php_http_object_t php_http_params_object_t;
-zend_class_entry *php_http_params_get_class_entry(void);
+PHP_HTTP_API zend_class_entry *php_http_params_class_entry;
PHP_MINIT_FUNCTION(http_params);
#define php_http_params_object_new php_http_object_new
#define php_http_params_object_new_ex php_http_object_new_ex
-PHP_METHOD(HttpParams, __construct);
-PHP_METHOD(HttpParams, toString);
-PHP_METHOD(HttpParams, toArray);
-PHP_METHOD(HttpParams, offsetExists);
-PHP_METHOD(HttpParams, offsetUnset);
-PHP_METHOD(HttpParams, offsetSet);
-PHP_METHOD(HttpParams, offsetGet);
-
#endif
/*
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
# include <ext/iconv/php_iconv.h>
#endif
-
#define QS_MERGE 1
static inline void php_http_querystring_set(zval *instance, zval *params, int flags TSRMLS_DC)
zval *qa;
if (flags & QS_MERGE) {
- qa = php_http_zsep(1, IS_ARRAY, zend_read_property(php_http_querystring_get_class_entry(), instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC));
+ qa = php_http_zsep(1, IS_ARRAY, zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC));
} else {
MAKE_STD_ZVAL(qa);
array_init(qa);
}
php_http_querystring_update(qa, params, NULL TSRMLS_CC);
- zend_update_property(php_http_querystring_get_class_entry(), instance, ZEND_STRL("queryArray"), qa TSRMLS_CC);
+ zend_update_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), qa TSRMLS_CC);
zval_ptr_dtor(&qa);
}
static inline void php_http_querystring_str(zval *instance, zval *return_value TSRMLS_DC)
{
- zval *qa = zend_read_property(php_http_querystring_get_class_entry(), instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC);
+ zval *qa = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC);
if (Z_TYPE_P(qa) == IS_ARRAY) {
php_http_querystring_update(qa, NULL, return_value TSRMLS_CC);
static inline void php_http_querystring_get(zval *this_ptr, int type, char *name, uint name_len, zval *defval, zend_bool del, zval *return_value TSRMLS_DC)
{
- zval **arrval, *qarray = zend_read_property(php_http_querystring_get_class_entry(), getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
+ zval **arrval, *qarray = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
if ((Z_TYPE_P(qarray) == IS_ARRAY) && (SUCCESS == zend_symtable_find(Z_ARRVAL_P(qarray), name, name_len + 1, (void *) &arrval))) {
if (type) {
ZVAL_NULL(&zv);
/* squeeze the hash out of the zval */
- if (Z_TYPE_P(params) == IS_OBJECT && instanceof_function(Z_OBJCE_P(params), php_http_querystring_get_class_entry() TSRMLS_CC)) {
- zv_ptr = php_http_ztyp(IS_ARRAY, zend_read_property(php_http_querystring_get_class_entry(), params, ZEND_STRL("queryArray"), 0 TSRMLS_CC));
+ if (Z_TYPE_P(params) == IS_OBJECT && instanceof_function(Z_OBJCE_P(params), php_http_querystring_class_entry TSRMLS_CC)) {
+ zv_ptr = php_http_ztyp(IS_ARRAY, zend_read_property(php_http_querystring_class_entry, params, ZEND_STRL("queryArray"), 0 TSRMLS_CC));
ptr = Z_ARRVAL_P(zv_ptr);
} else if (Z_TYPE_P(params) == IS_OBJECT || Z_TYPE_P(params) == IS_ARRAY) {
ptr = HASH_OF(params);
return SUCCESS;
}
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpQueryString, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpQueryString, method, 0)
-#define PHP_HTTP_QUERYSTRING_ME(method, visibility) PHP_ME(HttpQueryString, method, PHP_HTTP_ARGS(HttpQueryString, method), visibility)
-#define PHP_HTTP_QUERYSTRING_GME(method, visibility) PHP_ME(HttpQueryString, method, PHP_HTTP_ARGS(HttpQueryString, __getter), visibility)
-
-PHP_HTTP_BEGIN_ARGS(__construct, 0)
- PHP_HTTP_ARG_VAL(params, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getGlobalInstance);
-
-PHP_HTTP_EMPTY_ARGS(toArray);
-PHP_HTTP_EMPTY_ARGS(toString);
-
-PHP_HTTP_BEGIN_ARGS(get, 0)
- PHP_HTTP_ARG_VAL(name, 0)
- PHP_HTTP_ARG_VAL(type, 0)
- PHP_HTTP_ARG_VAL(defval, 0)
- PHP_HTTP_ARG_VAL(delete, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(set, 1)
- PHP_HTTP_ARG_VAL(params, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(mod, 0)
- PHP_HTTP_ARG_VAL(params, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(__getter, 1)
- PHP_HTTP_ARG_VAL(name, 0)
- PHP_HTTP_ARG_VAL(defval, 0)
- PHP_HTTP_ARG_VAL(delete, 0)
-PHP_HTTP_END_ARGS;
-
-#ifdef PHP_HTTP_HAVE_ICONV
-PHP_HTTP_BEGIN_ARGS(xlate, 2)
- PHP_HTTP_ARG_VAL(from_encoding, 0)
- PHP_HTTP_ARG_VAL(to_encoding, 0)
-PHP_HTTP_END_ARGS;
-#endif
-
-PHP_HTTP_EMPTY_ARGS(serialize);
-PHP_HTTP_BEGIN_ARGS(unserialize, 1)
- PHP_HTTP_ARG_VAL(serialized, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(offsetGet, 1)
- PHP_HTTP_ARG_VAL(offset, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(offsetSet, 2)
- PHP_HTTP_ARG_VAL(offset, 0)
- PHP_HTTP_ARG_VAL(value, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(offsetExists, 1)
- PHP_HTTP_ARG_VAL(offset, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_BEGIN_ARGS(offsetUnset, 1)
- PHP_HTTP_ARG_VAL(offset, 0)
-PHP_HTTP_END_ARGS;
-
-PHP_HTTP_EMPTY_ARGS(getIterator);
-
-static zend_class_entry *php_http_querystring_class_entry;
-
-zend_class_entry *php_http_querystring_get_class_entry(void)
-{
- return php_http_querystring_class_entry;
-}
-
-static zend_function_entry php_http_querystring_method_entry[] = {
- PHP_HTTP_QUERYSTRING_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR|ZEND_ACC_FINAL)
-
- PHP_HTTP_QUERYSTRING_ME(toArray, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_ME(toString, ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpQueryString, __toString, toString, PHP_HTTP_ARGS(HttpQueryString, toString), ZEND_ACC_PUBLIC)
-
- PHP_HTTP_QUERYSTRING_ME(get, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_ME(set, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_ME(mod, ZEND_ACC_PUBLIC)
-
- PHP_HTTP_QUERYSTRING_GME(getBool, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_GME(getInt, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_GME(getFloat, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_GME(getString, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_GME(getArray, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_GME(getObject, ZEND_ACC_PUBLIC)
-
- PHP_HTTP_QUERYSTRING_ME(getIterator, ZEND_ACC_PUBLIC)
-
- PHP_HTTP_QUERYSTRING_ME(getGlobalInstance, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
-#ifdef PHP_HTTP_HAVE_ICONV
- PHP_HTTP_QUERYSTRING_ME(xlate, ZEND_ACC_PUBLIC)
-#endif
-
- /* Implements Serializable */
- PHP_HTTP_QUERYSTRING_ME(serialize, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_ME(unserialize, ZEND_ACC_PUBLIC)
-
- /* Implements ArrayAccess */
- PHP_HTTP_QUERYSTRING_ME(offsetGet, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_ME(offsetSet, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_ME(offsetExists, ZEND_ACC_PUBLIC)
- PHP_HTTP_QUERYSTRING_ME(offsetUnset, ZEND_ACC_PUBLIC)
-
- EMPTY_FUNCTION_ENTRY
-};
-
-PHP_MINIT_FUNCTION(http_querystring)
-{
- PHP_HTTP_REGISTER_CLASS(http, QueryString, http_querystring, php_http_object_get_class_entry(), 0);
-
- zend_class_implements(php_http_querystring_class_entry TSRMLS_CC, 3, zend_ce_serializable, zend_ce_arrayaccess, zend_ce_aggregate);
-
- zend_declare_property_null(php_http_querystring_class_entry, ZEND_STRL("instance"), (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC);
- zend_declare_property_null(php_http_querystring_class_entry, ZEND_STRL("queryArray"), ZEND_ACC_PRIVATE TSRMLS_CC);
-
- zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_BOOL"), PHP_HTTP_QUERYSTRING_TYPE_BOOL TSRMLS_CC);
- zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_INT"), PHP_HTTP_QUERYSTRING_TYPE_INT TSRMLS_CC);
- zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_FLOAT"), PHP_HTTP_QUERYSTRING_TYPE_FLOAT TSRMLS_CC);
- zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_STRING"), PHP_HTTP_QUERYSTRING_TYPE_STRING TSRMLS_CC);
- zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_ARRAY"), PHP_HTTP_QUERYSTRING_TYPE_ARRAY TSRMLS_CC);
- zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_OBJECT"), PHP_HTTP_QUERYSTRING_TYPE_OBJECT TSRMLS_CC);
-
- return SUCCESS;
-}
-
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, params)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, __construct)
{
zval *params = NULL;
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", ¶ms)) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
php_http_querystring_set(getThis(), params, 0 TSRMLS_CC);
} end_error_handling();
}
} end_error_handling();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getGlobalInstance, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, getGlobalInstance)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters_none()) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
zval *instance = *zend_std_get_static_property(php_http_querystring_class_entry, ZEND_STRL("instance"), 0 PHP_HTTP_ZEND_LITERAL_CCN TSRMLS_CC);
if (Z_TYPE_P(instance) != IS_OBJECT) {
} end_error_handling();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, getIterator)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters_none()) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
zval *retval = NULL, *qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
object_init_ex(return_value, spl_ce_RecursiveArrayIterator);
} end_error_handling();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_toString, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, toString)
{
if (SUCCESS != zend_parse_parameters_none()) {
php_http_querystring_str(getThis(), return_value TSRMLS_CC);
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_toArray, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, toArray)
{
if (SUCCESS == zend_parse_parameters_none()) {
- RETURN_PROP(php_http_querystring_class_entry, "queryArray");
+ zval *zqa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
+ RETURN_ZVAL(zqa, 1, 0);
}
RETURN_FALSE;
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_get, 0, 0, 0)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, type)
+ ZEND_ARG_INFO(0, defval)
+ ZEND_ARG_INFO(0, delete)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, get)
{
char *name_str = NULL;
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_set, 0, 0, 1)
+ ZEND_ARG_INFO(0, params)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, set)
{
zval *params;
RETVAL_ZVAL(getThis(), 1, 0);
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_mod, 0, 0, 0)
+ ZEND_ARG_INFO(0, params)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, mod)
{
zval *params;
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶ms)) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
ZVAL_OBJVAL(return_value, Z_OBJ_HT_P(getThis())->clone_obj(getThis() TSRMLS_CC), 0);
php_http_querystring_set(return_value, params, QS_MERGE TSRMLS_CC);
} end_error_handling();
} end_error_handling();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString___getter, 0, 0, 1)
+ ZEND_ARG_INFO(0, name)
+ ZEND_ARG_INFO(0, defval)
+ ZEND_ARG_INFO(0, delete)
+ZEND_END_ARG_INFO();
#define PHP_HTTP_QUERYSTRING_GETTER(method, TYPE) \
PHP_METHOD(HttpQueryString, method) \
{ \
PHP_HTTP_QUERYSTRING_GETTER(getObject, IS_OBJECT);
#ifdef PHP_HTTP_HAVE_ICONV
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_xlate, 0, 0, 2)
+ ZEND_ARG_INFO(0, from_encoding)
+ ZEND_ARG_INFO(0, to_encoding)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, xlate)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
char *ie, *oe;
int ie_len, oe_len;
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &ie, &ie_len, &oe, &oe_len)) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
zval *na, *qa = php_http_ztyp(IS_ARRAY, zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC));
MAKE_STD_ZVAL(na);
}
#endif /* HAVE_ICONV */
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_serialize, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, serialize)
{
if (SUCCESS != zend_parse_parameters_none()) {
php_http_querystring_str(getThis(), return_value TSRMLS_CC);
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, unserialize)
{
zval *serialized;
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &serialized)) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
if (Z_TYPE_P(serialized) == IS_STRING) {
php_http_querystring_set(getThis(), serialized, 0 TSRMLS_CC);
} else {
} end_error_handling();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetGet, 0, 0, 1)
+ ZEND_ARG_INFO(0, offset)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, offsetGet)
{
char *offset_str;
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetSet, 0, 0, 2)
+ ZEND_ARG_INFO(0, offset)
+ ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, offsetSet)
{
char *offset_str;
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetExists, 0, 0, 1)
+ ZEND_ARG_INFO(0, offset)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, offsetExists)
{
char *offset_str;
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetUnset, 0, 0, 1)
+ ZEND_ARG_INFO(0, offset)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpQueryString, offsetUnset)
{
char *offset_str;
}
}
+zend_class_entry *php_http_querystring_class_entry;
+
+static zend_function_entry php_http_querystring_methods[] = {
+ PHP_ME(HttpQueryString, __construct, ai_HttpQueryString___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR|ZEND_ACC_FINAL)
+
+ PHP_ME(HttpQueryString, toArray, ai_HttpQueryString_toArray, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, toString, ai_HttpQueryString_toString, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpQueryString, __toString, toString, ai_HttpQueryString_toString, ZEND_ACC_PUBLIC)
+
+ PHP_ME(HttpQueryString, get, ai_HttpQueryString_get, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, set, ai_HttpQueryString_set, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, mod, ai_HttpQueryString_mod, ZEND_ACC_PUBLIC)
+
+ PHP_ME(HttpQueryString, getBool, ai_HttpQueryString___getter, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, getInt, ai_HttpQueryString___getter, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, getFloat, ai_HttpQueryString___getter, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, getString, ai_HttpQueryString___getter, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, getArray, ai_HttpQueryString___getter, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, getObject, ai_HttpQueryString___getter, ZEND_ACC_PUBLIC)
+
+ PHP_ME(HttpQueryString, getIterator, ai_HttpQueryString_getIterator, ZEND_ACC_PUBLIC)
+
+ PHP_ME(HttpQueryString, getGlobalInstance, ai_HttpQueryString_getGlobalInstance, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+#ifdef PHP_HTTP_HAVE_ICONV
+ PHP_ME(HttpQueryString, xlate, ai_HttpQueryString_xlate, ZEND_ACC_PUBLIC)
+#endif
+
+ /* Implements Serializable */
+ PHP_ME(HttpQueryString, serialize, ai_HttpQueryString_serialize, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, unserialize, ai_HttpQueryString_unserialize, ZEND_ACC_PUBLIC)
+
+ /* Implements ArrayAccess */
+ PHP_ME(HttpQueryString, offsetGet, ai_HttpQueryString_offsetGet, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, offsetSet, ai_HttpQueryString_offsetSet, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, offsetExists, ai_HttpQueryString_offsetExists, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpQueryString, offsetUnset, ai_HttpQueryString_offsetUnset, ZEND_ACC_PUBLIC)
+
+ EMPTY_FUNCTION_ENTRY
+};
+
+PHP_MINIT_FUNCTION(http_querystring)
+{
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http", "QueryString", php_http_querystring_methods);
+ php_http_querystring_class_entry = zend_register_internal_class_ex(&ce, php_http_object_class_entry, NULL TSRMLS_CC);
+ zend_class_implements(php_http_querystring_class_entry TSRMLS_CC, 3, zend_ce_serializable, zend_ce_arrayaccess, zend_ce_aggregate);
+
+ zend_declare_property_null(php_http_querystring_class_entry, ZEND_STRL("instance"), (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC);
+ zend_declare_property_null(php_http_querystring_class_entry, ZEND_STRL("queryArray"), ZEND_ACC_PRIVATE TSRMLS_CC);
+
+ zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_BOOL"), PHP_HTTP_QUERYSTRING_TYPE_BOOL TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_INT"), PHP_HTTP_QUERYSTRING_TYPE_INT TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_FLOAT"), PHP_HTTP_QUERYSTRING_TYPE_FLOAT TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_STRING"), PHP_HTTP_QUERYSTRING_TYPE_STRING TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_ARRAY"), PHP_HTTP_QUERYSTRING_TYPE_ARRAY TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_querystring_class_entry, ZEND_STRL("TYPE_OBJECT"), PHP_HTTP_QUERYSTRING_TYPE_OBJECT TSRMLS_CC);
+
+ return SUCCESS;
+}
/*
* Local variables:
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
#define PHP_HTTP_QUERYSTRING_TYPE_ARRAY IS_ARRAY
#define PHP_HTTP_QUERYSTRING_TYPE_OBJECT IS_OBJECT
-zend_class_entry *php_http_querystring_get_class_entry(void);
+PHP_HTTP_API zend_class_entry *php_http_querystring_class_entry;
PHP_MINIT_FUNCTION(http_querystring);
#define php_http_querystring_object_new php_http_object_new
#define php_http_querystring_object_new_ex php_http_object_new_ex
-PHP_METHOD(HttpQueryString, getGlobalInstance);
-PHP_METHOD(HttpQueryString, __construct);
-PHP_METHOD(HttpQueryString, getIterator);
-PHP_METHOD(HttpQueryString, toString);
-PHP_METHOD(HttpQueryString, toArray);
-PHP_METHOD(HttpQueryString, get);
-PHP_METHOD(HttpQueryString, set);
-PHP_METHOD(HttpQueryString, mod);
-PHP_METHOD(HttpQueryString, getBool);
-PHP_METHOD(HttpQueryString, getInt);
-PHP_METHOD(HttpQueryString, getFloat);
-PHP_METHOD(HttpQueryString, getString);
-PHP_METHOD(HttpQueryString, getArray);
-PHP_METHOD(HttpQueryString, getObject);
-#ifdef PHP_HTTP_HAVE_ICONV
-PHP_METHOD(HttpQueryString, xlate);
-#endif /* PHP_HTTP_HAVE_ICONV */
-PHP_METHOD(HttpQueryString, factory);
-PHP_METHOD(HttpQueryString, singleton);
-PHP_METHOD(HttpQueryString, serialize);
-PHP_METHOD(HttpQueryString, unserialize);
-PHP_METHOD(HttpQueryString, offsetGet);
-PHP_METHOD(HttpQueryString, offsetSet);
-PHP_METHOD(HttpQueryString, offsetExists);
-PHP_METHOD(HttpQueryString, offsetUnset);
-
#endif /* PHP_HTTP_QUERYSTRING_H */
/*
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
return estrndup("localhost", lenof("localhost"));
}
+static inline unsigned port(const char *scheme)
+{
+ unsigned port = 80;
+
+#if defined(ZTS) && defined(HAVE_GETSERVBYPORT_R)
+ int rc;
+ size_t len = 0xff;
+ char *buf = NULL;
+ struct servent *se_res = NULL, se_buf = {0};
+
+ do {
+ buf = erealloc(buf, len);
+ rc = getservbyname_r(scheme, "tcp", &se_buf, buf, len, &se_res);
+ len *= 2;
+ } while (rc == ERANGE && len <= 0xfff);
+
+ if (!rc) {
+ port = ntohs(se_res->s_port);
+ }
+
+ efree(buf);
+#elif !defined(ZTS) && defined(HAVE_GETSERVBYPORT)
+ struct servent *se;
+
+ if ((se = getservbyname(scheme, "tcp")) && se->s_port) {
+ port = ntohs(se->s_port);
+ }
+#endif
+
+ return port;
+}
+static inline char *scheme(unsigned port)
+{
+ char *scheme;
+#if defined(ZTS) && defined(HAVE_GETSERVBYPORT_R)
+ int rc;
+ size_t len = 0xff;
+ char *buf = NULL;
+ struct servent *se_res = NULL, se_buf = {0};
+#elif !defined(ZTS) && defined(HAVE_GETSERVBYPORT)
+ struct servent *se;
+#endif
+
+ switch (port) {
+ case 443:
+ scheme = estrndup("https", lenof("https"));
+ break;
+
+#if defined(ZTS) && !defined(HAVE_GETSERVBYPORT_R)
+ default:
+#elif !defined(ZTS) && !defined(HAVE_GETSERVBYPORT)
+ default:
+#endif
+ case 80:
+ case 0:
+ scheme = estrndup("http", lenof("http"));
+ break;
+
+#if defined(ZTS) && defined(HAVE_GETSERVBYPORT_R)
+ default:
+ do {
+ buf = erealloc(buf, len);
+ rc = getservbyport_r(htons(port), "tcp", &se_buf, buf, len, &se_res);
+ len *= 2;
+ } while (rc == ERANGE && len <= 0xfff);
+
+ if (!rc && se_res) {
+ scheme = estrdup(se_res->s_name);
+ } else {
+ scheme = estrndup("http", lenof("http"));
+ }
+
+ efree(buf);
+ break;
+
+#elif !defined(ZTS) && defined(HAVE_GETSERVBYPORT)
+ default:
+ if ((se = getservbyport(htons(port), "tcp")) && se->s_name) {
+ scheme = estrdup(se->s_name);
+ } else {
+ scheme = estrndup("http", lenof("http"));
+ }
+ break;
+#endif
+ }
+ return scheme;
+}
+
static php_url *php_http_url_from_env(php_url *url TSRMLS_DC)
{
zval *https, *zhost, *zport;
long port;
-#ifdef HAVE_GETSERVBYPORT
- struct servent *se;
-#endif
if (!url) {
url = ecalloc(1, sizeof(*url));
https = php_http_env_get_server_var(ZEND_STRL("HTTPS"), 1 TSRMLS_CC);
if (https && !strcasecmp(Z_STRVAL_P(https), "ON")) {
url->scheme = estrndup("https", lenof("https"));
- } else switch (url->port) {
- case 443:
- url->scheme = estrndup("https", lenof("https"));
- break;
-
-#ifndef HAVE_GETSERVBYPORT
- default:
-#endif
- case 80:
- case 0:
- url->scheme = estrndup("http", lenof("http"));
- break;
-
-#ifdef HAVE_GETSERVBYPORT
- default:
- if ((se = getservbyport(htons(url->port), "tcp")) && se->s_name) {
- url->scheme = estrdup(se->s_name);
- } else {
- url->scheme = estrndup("http", lenof("http"));
- }
- break;
-#endif
+ } else {
+ url->scheme = scheme(url->port);
}
/* host */
PHP_HTTP_API void php_http_url(int flags, const php_url *old_url, const php_url *new_url, php_url **url_ptr, char **url_str, size_t *url_len TSRMLS_DC)
{
php_url *url, *tmp_url = NULL;
-#ifdef HAVE_GETSERVBYNAME
- struct servent *se;
-#endif
/* set from env if requested */
if (flags & PHP_HTTP_URL_FROM_ENV) {
if (url->port) {
if ( ((url->port == 80) && !strcmp(url->scheme, "http"))
|| ((url->port ==443) && !strcmp(url->scheme, "https"))
-#ifdef HAVE_GETSERVBYNAME
- || ((se = getservbyname(url->scheme, "tcp")) && se->s_port &&
- (url->port == ntohs(se->s_port)))
-#endif
+ || ( url->port == port(url->scheme))
) {
url->port = 0;
}
return SUCCESS;
}
-#define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpUrl, method, 0, req_args)
-#define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpUrl, method, 0)
-#define PHP_HTTP_URL_ME(method, visibility) PHP_ME(HttpUrl, method, PHP_HTTP_ARGS(HttpUrl, method), visibility)
-
-PHP_HTTP_BEGIN_ARGS(__construct, 0)
- PHP_HTTP_ARG_VAL(old_url, 0)
- PHP_HTTP_ARG_VAL(new_url, 0)
- PHP_HTTP_ARG_VAL(flags, 0)
-PHP_HTTP_END_ARGS;
-PHP_HTTP_EMPTY_ARGS(toString);
-PHP_HTTP_EMPTY_ARGS(toArray);
-
-PHP_HTTP_BEGIN_ARGS(mod, 1)
- PHP_HTTP_ARG_VAL(more_url_parts, 0)
- PHP_HTTP_ARG_VAL(flags, 0)
-PHP_HTTP_END_ARGS;
-
-static zend_class_entry *php_http_url_class_entry;
-
-zend_class_entry *php_http_url_get_class_entry(void)
-{
- return php_http_url_class_entry;
-}
-
-static zend_function_entry php_http_url_method_entry[] = {
- PHP_HTTP_URL_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
- PHP_HTTP_URL_ME(mod, ZEND_ACC_PUBLIC)
- PHP_HTTP_URL_ME(toString, ZEND_ACC_PUBLIC)
- ZEND_MALIAS(HttpUrl, __toString, toString, PHP_HTTP_ARGS(HttpUrl, toString), ZEND_ACC_PUBLIC)
- PHP_HTTP_URL_ME(toArray, ZEND_ACC_PUBLIC)
- EMPTY_FUNCTION_ENTRY
-};
-
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpUrl___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, old_url)
+ ZEND_ARG_INFO(0, new_url)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpUrl, __construct)
{
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
zval *new_url = NULL, *old_url = NULL;
long flags = PHP_HTTP_URL_FROM_ENV;
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!z!l", &old_url, &new_url, &flags)) {
- with_error_handling(EH_THROW, php_http_exception_get_class_entry()) {
+ with_error_handling(EH_THROW, php_http_exception_class_entry) {
php_url *res_purl, *new_purl = NULL, *old_purl = NULL;
if (new_url) {
} end_error_handling();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpUrl_mod, 0, 0, 1)
+ ZEND_ARG_INFO(0, more_url_parts)
+ ZEND_ARG_INFO(0, flags)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpUrl, mod)
{
zval *new_url = NULL;
}
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpUrl_toString, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpUrl, toString)
{
if (SUCCESS == zend_parse_parameters_none()) {
RETURN_EMPTY_STRING();
}
+ZEND_BEGIN_ARG_INFO_EX(ai_HttpUrl_toArray, 0, 0, 0)
+ZEND_END_ARG_INFO();
PHP_METHOD(HttpUrl, toArray)
{
if (SUCCESS != zend_parse_parameters_none()) {
array_copy(HASH_OF(getThis()), HASH_OF(return_value));
}
+static zend_function_entry php_http_url_methods[] = {
+ PHP_ME(HttpUrl, __construct, ai_HttpUrl___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
+ PHP_ME(HttpUrl, mod, ai_HttpUrl_mod, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpUrl, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC)
+ ZEND_MALIAS(HttpUrl, __toString, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC)
+ PHP_ME(HttpUrl, toArray, ai_HttpUrl_toArray, ZEND_ACC_PUBLIC)
+ EMPTY_FUNCTION_ENTRY
+};
+
+zend_class_entry *php_http_url_class_entry;
+
PHP_MINIT_FUNCTION(http_url)
{
- PHP_HTTP_REGISTER_CLASS(http, Url, http_url, php_http_object_get_class_entry(), 0);
+ zend_class_entry ce = {0};
+
+ INIT_NS_CLASS_ENTRY(ce, "http", "Url", php_http_url_methods);
+ php_http_url_class_entry = zend_register_internal_class_ex(&ce, php_http_object_class_entry, NULL TSRMLS_CC);
zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("scheme"), ZEND_ACC_PUBLIC TSRMLS_CC);
zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("user"), ZEND_ACC_PUBLIC TSRMLS_CC);
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
return Z_ARRVAL(arr);
}
-zend_class_entry *php_http_url_get_class_entry(void);
+PHP_HTTP_API zend_class_entry *php_http_url_class_entry;
+PHP_MINIT_FUNCTION(http_url);
#define php_http_url_object_new php_http_object_new
#define php_http_url_object_new_ex php_http_object_new_ex
-PHP_METHOD(HttpUrl, __construct);
-PHP_METHOD(HttpUrl, mod);
-PHP_METHOD(HttpUrl, toString);
-PHP_METHOD(HttpUrl, toArray);
-
-PHP_MINIT_FUNCTION(http_url);
-
#endif
/*
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2011, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2013, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
\["cookies"\]\=\>
array\(1\) \{
\["temp"\]\=\>
- string\(13\) "\d+\.\d+"
+ string\(1[23]\) "\d+\.\d+"
\}
\["extras"\]\=\>
array\(0\) \{
\["cookies"\]\=\>
array\(1\) \{
\["perm"\]\=\>
- string\(13\) "\d+\.\d+"
+ string\(1[23]\) "\d+\.\d+"
\}
\["extras"\]\=\>
array\(0\) \{