lingering TSRM macros
authorMichael Wallner <mike@php.net>
Mon, 20 Jul 2015 12:57:54 +0000 (14:57 +0200)
committerMichael Wallner <mike@php.net>
Mon, 20 Jul 2015 12:57:54 +0000 (14:57 +0200)
25 files changed:
php_http.c
php_http_client_curl.c
php_http_cookie.c
php_http_cookie.h
php_http_encoding.c
php_http_env.c
php_http_env_request.c
php_http_env_response.c
php_http_header.c
php_http_header_parser.c
php_http_info.c
php_http_message.c
php_http_message_parser.c
php_http_misc.c
php_http_negotiate.c
php_http_negotiate.h
php_http_object.h
php_http_params.c
php_http_querystring.c
php_http_url.c
php_http_version.c
php_http_version.h
tests/client026.phpt
tests/helper/dump.inc
tests/helper/server.inc

index 6d4384d..f9bb4d0 100644 (file)
@@ -106,11 +106,11 @@ static void php_http_globals_init_once(zend_php_http_globals *G)
 }
 
 #if 0
-static inline void php_http_globals_init(zend_php_http_globals *G TSRMLS_DC)
+static inline void php_http_globals_init(zend_php_http_globals *G)
 {
 }
 
-static inline void php_http_globals_free(zend_php_http_globals *G TSRMLS_DC)
+static inline void php_http_globals_free(zend_php_http_globals *G)
 {
 }
 #endif
index b91fe48..cb53064 100644 (file)
@@ -220,7 +220,6 @@ static int php_http_curle_progress_callback(void *ctx, double dltotal, double dl
 static int php_http_curle_seek_callback(void *userdata, curl_off_t offset, int origin)
 {
        php_http_message_body_t *body = userdata;
-       TSRMLS_FETCH_FROM_CTX(body->ts);
 
        if (!body) {
                return 1;
@@ -603,14 +602,14 @@ static int compare_queue(php_http_client_enqueue_t *e, void *handle)
        return handle == ((php_http_client_curl_handler_t *) e->opaque)->handle;
 }
 
-static php_http_message_t *php_http_curlm_responseparser(php_http_client_curl_handler_t *h TSRMLS_DC)
+static php_http_message_t *php_http_curlm_responseparser(php_http_client_curl_handler_t *h)
 {
        php_http_message_t *response;
        php_http_header_parser_t parser;
        zval *zh;
 
-       response = php_http_message_init(NULL, 0, h->response.body TSRMLS_CC);
-       php_http_header_parser_init(&parser TSRMLS_CC);
+       response = php_http_message_init(NULL, 0, h->response.body);
+       php_http_header_parser_init(&parser);
        while (h->response.headers.used) {
                php_http_header_parser_state_t st = php_http_header_parser_parse(&parser,
                                &h->response.headers, PHP_HTTP_HEADER_PARSER_CLEANUP, &response->hdrs,
@@ -687,7 +686,7 @@ static void php_http_curlm_responsehandler(php_http_client_t *context)
 
                        if ((enqueue = php_http_client_enqueued(context, msg->easy_handle, compare_queue))) {
                                php_http_client_curl_handler_t *handler = enqueue->opaque;
-                               php_http_message_t *response = php_http_curlm_responseparser(handler TSRMLS_CC);
+                               php_http_message_t *response = php_http_curlm_responseparser(handler);
 
                                if (response) {
                                        context->callback.response.func(context->callback.response.arg, context, &handler->queue, &response);
@@ -701,7 +700,7 @@ static void php_http_curlm_responsehandler(php_http_client_t *context)
                int i = 0;
 
                do {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s; %s (%s)", curl_easy_strerror(err[i].errorcode), err[i].errorbuffer, STR_PTR(err[i].url));
+                       php_error_docref(NULL, E_WARNING, "%s; %s (%s)", curl_easy_strerror(err[i].errorcode), err[i].errorbuffer, STR_PTR(err[i].url));
                        if (err[i].url) {
                                efree(err[i].url);
                        }
@@ -1643,7 +1642,6 @@ static ZEND_RESULT_CODE php_http_curlm_option_set_pipelining_bl(php_http_option_
        CURLM *ch = curl->handle;
        HashTable tmp_ht;
        char **bl = NULL;
-       TSRMLS_FETCH_FROM_CTX(client->ts);
 
        /* array of char *, ending with a NULL */
        if (value && Z_TYPE_P(value) != IS_NULL) {
@@ -1714,7 +1712,7 @@ static ZEND_RESULT_CODE php_http_curlm_option_set_use_eventloop(php_http_option_
 }
 #endif
 
-static void php_http_curlm_options_init(php_http_options_t *registry TSRMLS_DC)
+static void php_http_curlm_options_init(php_http_options_t *registry)
 {
        php_http_option_t *opt;
 
@@ -1812,7 +1810,7 @@ static ZEND_RESULT_CODE php_http_curlm_set_option(php_http_option_t *opt, zval *
        }
 
        if (rv != SUCCESS) {
-               php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_easy_strerror(rc));
+               php_error_docref(NULL, E_NOTICE, "Could not set option %s (%s)", opt->name->val, curl_easy_strerror(rc));
        }
        return rv;
 }
@@ -2019,7 +2017,7 @@ static ZEND_RESULT_CODE php_http_client_curl_handler_prepare(php_http_client_cur
                        curl_easy_setopt(curl->handle, CURLOPT_CUSTOMREQUEST, PHP_HTTP_INFO(msg).request.method);
                }
        } else {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot use empty request method");
+               php_error_docref(NULL, E_WARNING, "Cannot use empty request method");
                return FAILURE;
        }
 
@@ -2414,7 +2412,6 @@ static int apply_available_options(zval *pDest, int num_args, va_list args, zend
 static ZEND_RESULT_CODE php_http_client_curl_getopt(php_http_client_t *h, php_http_client_getopt_opt_t opt, void *arg, void **res)
 {
        php_http_client_enqueue_t *enqueue;
-       TSRMLS_FETCH_FROM_CTX(h->ts);
 
        switch (opt) {
        case PHP_HTTP_CLIENT_OPT_PROGRESS_INFO:
@@ -2436,11 +2433,11 @@ static ZEND_RESULT_CODE php_http_client_curl_getopt(php_http_client_t *h, php_ht
                break;
 
        case PHP_HTTP_CLIENT_OPT_AVAILABLE_OPTIONS:
-               zend_hash_apply_with_arguments(&php_http_curle_options.options TSRMLS_CC, apply_available_options, 1, *(HashTable **) res);
+               zend_hash_apply_with_arguments(&php_http_curle_options.options, apply_available_options, 1, *(HashTable **) res);
                break;
 
        case PHP_HTTP_CLIENT_OPT_AVAILABLE_CONFIGURATION:
-               zend_hash_apply_with_arguments(&php_http_curlm_options.options TSRMLS_CC, apply_available_options, 1, *(HashTable **) res);
+               zend_hash_apply_with_arguments(&php_http_curlm_options.options, apply_available_options, 1, *(HashTable **) res);
                break;
 
        default:
index df67af6..9625401 100644 (file)
@@ -413,7 +413,7 @@ zend_object *php_http_cookie_object_clone(zval *obj)
        return &new_obj->zo;
 }
 
-void php_http_cookie_object_free(zend_object *object TSRMLS_DC)
+void php_http_cookie_object_free(zend_object *object)
 {
        php_http_cookie_object_t *obj = PHP_HTTP_OBJ(object, NULL);
 
@@ -926,7 +926,7 @@ static PHP_METHOD(HttpCookie, setFlags)
        long flags = 0;
        php_http_cookie_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags), invalid_arg, return);
 
        obj = PHP_HTTP_OBJ(NULL, getThis());
 
@@ -1024,9 +1024,9 @@ PHP_MINIT_FUNCTION(http_cookie)
        php_http_cookie_object_handlers.clone_obj = php_http_cookie_object_clone;
        php_http_cookie_object_handlers.free_obj = php_http_cookie_object_free;
 
-       zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("PARSE_RAW"), PHP_HTTP_COOKIE_PARSE_RAW TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("SECURE"), PHP_HTTP_COOKIE_SECURE TSRMLS_CC);
-       zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("HTTPONLY"), PHP_HTTP_COOKIE_HTTPONLY TSRMLS_CC);
+       zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("PARSE_RAW"), PHP_HTTP_COOKIE_PARSE_RAW);
+       zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("SECURE"), PHP_HTTP_COOKIE_SECURE);
+       zend_declare_class_constant_long(php_http_cookie_class_entry, ZEND_STRL("HTTPONLY"), PHP_HTTP_COOKIE_HTTPONLY);
 
        return SUCCESS;
 }
index 9e63cbe..f7dbf8d 100644 (file)
@@ -63,7 +63,7 @@ typedef struct php_http_cookie_object {
 zend_object *php_http_cookie_object_new(zend_class_entry *ce);
 php_http_cookie_object_t *php_http_cookie_object_new_ex(zend_class_entry *ce, php_http_cookie_list_t *list);
 zend_object *php_http_cookie_object_clone(zval *this_ptr);
-void php_http_cookie_object_free(zend_object *object TSRMLS_DC);
+void php_http_cookie_object_free(zend_object *object);
 
 PHP_MINIT_FUNCTION(http_cookie);
 
index ffa10b3..e7557a0 100644 (file)
@@ -634,7 +634,7 @@ static ZEND_RESULT_CODE dechunk_update(php_http_encoding_stream_t *s, const char
                                        /*      if strtoul() stops at the beginning of the buffered data
                                                there's something oddly wrong, i.e. bad input */
                                        if (stop == ctx->buffer.data) {
-                                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse chunk len from '%.*s'", (int) MIN(16, ctx->buffer.used), ctx->buffer.data);
+                                               php_error_docref(NULL, E_WARNING, "Failed to parse chunk len from '%.*s'", (int) MIN(16, ctx->buffer.used), ctx->buffer.data);
                                                php_http_buffer_dtor(&tmp);
                                                return FAILURE;
                                        }
index f5c72d6..df22d5a 100644 (file)
@@ -33,7 +33,7 @@ PHP_RSHUTDOWN_FUNCTION(http_env)
        return SUCCESS;
 }
 
-void php_http_env_get_request_headers(HashTable *headers TSRMLS_DC)
+void php_http_env_get_request_headers(HashTable *headers)
 {
        php_http_arrkey_t key;
        zval *hsv, *header;
@@ -574,7 +574,7 @@ static PHP_METHOD(HttpEnv, getResponseStatusForCode)
        zend_long code;
        const char *status;
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &code)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "l", &code)) {
                return;
        }
 
@@ -672,7 +672,7 @@ static PHP_METHOD(HttpEnv, negotiateLanguage)
        HashTable *supported;
        zval *rs_array = NULL;
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H|z", &supported, &rs_array)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "H|z", &supported, &rs_array)) {
                return;
        }
        if (rs_array) {
@@ -757,7 +757,7 @@ static PHP_METHOD(HttpEnv, negotiate)
        char *value_str, *sep_str = NULL;
        size_t value_len, sep_len = 0;
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sH|s!z", &value_str, &value_len, &supported, &sep_str, &sep_len, &rs_array)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "sH|s!z", &value_str, &value_len, &supported, &sep_str, &sep_len, &rs_array)) {
                return;
        }
 
index 355c692..5f1d130 100644 (file)
@@ -172,7 +172,7 @@ static PHP_METHOD(HttpEnvRequest, __construct)
                add_next_index_stringl(&mn, ZEND_STRL("get")); \
                zend_fcall_info_init(&mn, 0, &fci, &fcc, NULL, NULL); \
                zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args); \
-               zend_fcall_info_argp(&fci TSRMLS_CC, ZEND_NUM_ARGS(), args); \
+               zend_fcall_info_argp(&fci, ZEND_NUM_ARGS(), args); \
                zend_fcall_info_call(&fci, &fcc, &rv, NULL); \
                zend_fcall_info_args_clear(&fci, 1); \
                efree(args); \
index 7702ddd..9bc3f5b 100644 (file)
@@ -1096,7 +1096,7 @@ static ZEND_RESULT_CODE php_http_env_response_stream_finish(php_http_env_respons
        php_stream_flush(ctx->stream);
        if (ctx->chunked && ctx->chunked_filter) {
                php_stream_filter_flush(ctx->chunked_filter, 1);
-               ctx->chunked_filter = php_stream_filter_remove(ctx->chunked_filter, 1 TSRMLS_CC);
+               ctx->chunked_filter = php_stream_filter_remove(ctx->chunked_filter, 1);
        }
 
        ctx->finished = 1;
@@ -1291,7 +1291,7 @@ static PHP_METHOD(HttpEnvResponse, isCachedByEtag)
        char *header_name_str = NULL;
        size_t header_name_len = 0;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &header_name_str, &header_name_len)) {
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &header_name_str, &header_name_len)) {
                if (!header_name_str || !header_name_len) {
                        header_name_str = "If-None-Match";
                        header_name_len = lenof("If-None-Match");
index 19cb936..d4f2b51 100644 (file)
@@ -19,13 +19,13 @@ ZEND_RESULT_CODE php_http_header_parse(const char *header, size_t length, HashTa
        php_http_header_parser_state_t rs;
        
        if (!php_http_buffer_from_string_ex(&buf, header, length)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not allocate buffer");
+               php_error_docref(NULL, E_WARNING, "Could not allocate buffer");
                return FAILURE;
        }
        
-       if (!php_http_header_parser_init(&ctx TSRMLS_CC)) {
+       if (!php_http_header_parser_init(&ctx)) {
                php_http_buffer_dtor(&buf);
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not initialize header parser");
+               php_error_docref(NULL, E_WARNING, "Could not initialize header parser");
                return FAILURE;
        }
        
@@ -36,7 +36,7 @@ ZEND_RESULT_CODE php_http_header_parse(const char *header, size_t length, HashTa
        return rs == PHP_HTTP_HEADER_PARSER_STATE_FAILURE ? FAILURE : SUCCESS;
 }
 
-void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pass_format_callback_t cb, void *cb_arg TSRMLS_DC)
+void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pass_format_callback_t cb, void *cb_arg)
 {
        php_http_arrkey_t key;
        zval *header, *single_header;
@@ -78,9 +78,9 @@ void php_http_header_to_callback(HashTable *headers, zend_bool crlf, php_http_pa
        ZEND_HASH_FOREACH_END();
 }
 
-void php_http_header_to_string(php_http_buffer_t *str, HashTable *headers TSRMLS_DC)
+void php_http_header_to_string(php_http_buffer_t *str, HashTable *headers)
 {
-       php_http_header_to_callback(headers, 1, (php_http_pass_format_callback_t) php_http_buffer_appendf, str TSRMLS_CC);
+       php_http_header_to_callback(headers, 1, (php_http_pass_format_callback_t) php_http_buffer_appendf, str);
 }
 
 zend_string *php_http_header_value_array_to_string(zval *header)
@@ -173,7 +173,7 @@ PHP_METHOD(HttpHeader, unserialize)
        char *serialized_str;
        size_t serialized_len;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized_str, &serialized_len)) {
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized_str, &serialized_len)) {
                HashTable ht;
 
                zend_hash_init(&ht, 1, NULL, ZVAL_PTR_DTOR, 0);
@@ -311,7 +311,7 @@ PHP_METHOD(HttpHeader, parse)
                        zval_dtor(return_value);
                        RETURN_FALSE;
                } else {
-                       if (ce && instanceof_function(ce, php_http_header_class_entry TSRMLS_CC)) {
+                       if (ce && instanceof_function(ce, php_http_header_class_entry)) {
                                php_http_arrkey_t key;
                                zval *val;
 
index f4dcf95..e1ebe12 100644 (file)
@@ -122,7 +122,7 @@ php_http_header_parser_state_t php_http_header_parser_parse(php_http_header_pars
 #endif
                switch (php_http_header_parser_state_pop(parser)) {
                        case PHP_HTTP_HEADER_PARSER_STATE_FAILURE:
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse headers");
+                               php_error_docref(NULL, E_WARNING, "Failed to parse headers");
                                return php_http_header_parser_state_push(parser, 1, PHP_HTTP_HEADER_PARSER_STATE_FAILURE);
 
                        case PHP_HTTP_HEADER_PARSER_STATE_START: {
@@ -162,7 +162,7 @@ php_http_header_parser_state_t php_http_header_parser_parse(php_http_header_pars
 
                                        valid_len = strspn(parser->_key.str, PHP_HTTP_HEADER_NAME_CHARS);
                                        if (valid_len != parser->_key.len) {
-                                               php_http_header_parser_error(valid_len, parser->_key.str, parser->_key.len, eol_str TSRMLS_CC);
+                                               php_http_header_parser_error(valid_len, parser->_key.str, parser->_key.len, eol_str);
                                                PTR_SET(parser->_key.str, NULL);
                                                return php_http_header_parser_state_push(parser, 1, PHP_HTTP_HEADER_PARSER_STATE_FAILURE);
                                        }
@@ -172,7 +172,7 @@ php_http_header_parser_state_t php_http_header_parser_parse(php_http_header_pars
                                } else if (eol_str || (flags & PHP_HTTP_HEADER_PARSER_CLEANUP)) {
                                        /* neither reqeust/response line nor 'header:' string, or injected new line or NUL etc. */
                                        php_http_buffer_fix(buffer);
-                                       php_http_header_parser_error(strspn(buffer->data, PHP_HTTP_HEADER_NAME_CHARS), buffer->data, buffer->used, eol_str TSRMLS_CC);
+                                       php_http_header_parser_error(strspn(buffer->data, PHP_HTTP_HEADER_NAME_CHARS), buffer->data, buffer->used, eol_str);
                                        return php_http_header_parser_state_push(parser, 1, PHP_HTTP_HEADER_PARSER_STATE_FAILURE);
                                } else {
                                        /* keep feeding */
@@ -245,7 +245,7 @@ php_http_header_parser_state_t php_http_header_parser_parse(php_http_header_pars
 
                                        /* check for truncation */
                                        if (valid_len != parser->_val.len) {
-                                               php_http_header_parser_error(valid_len, parser->_val.str, parser->_val.len, NULL TSRMLS_CC);
+                                               php_http_header_parser_error(valid_len, parser->_val.str, parser->_val.len, NULL);
 
                                                PTR_SET(parser->_key.str, NULL);
                                                PTR_SET(parser->_val.str, NULL);
@@ -285,7 +285,6 @@ php_http_header_parser_state_t php_http_header_parser_parse(php_http_header_pars
 php_http_header_parser_state_t php_http_header_parser_parse_stream(php_http_header_parser_t *parser, php_http_buffer_t *buf, php_stream *s, unsigned flags, HashTable *headers, php_http_info_callback_t callback_func, void *callback_arg)
 {
        php_http_header_parser_state_t state = PHP_HTTP_HEADER_PARSER_STATE_START;
-       TSRMLS_FETCH_FROM_CTX(parser->ts);
 
        if (!buf->data) {
                php_http_buffer_resize_ex(buf, 0x1000, 1, 0);
index 88025cc..f389be9 100644 (file)
@@ -69,7 +69,7 @@ php_http_info_t *php_http_info_parse(php_http_info_t *info, const char *pre_head
                return NULL;
        }
        
-       info = php_http_info_init(info TSRMLS_CC);
+       info = php_http_info_init(info);
 
        /* and nothing than SPACE or NUL after HTTP/X.x */
        if (!php_http_version_parse(&info->http.version, http)
index a6b30f5..0982f06 100644 (file)
@@ -86,7 +86,7 @@ php_http_message_t *php_http_message_init_env(php_http_message_t *message, php_h
                        php_http_env_get_response_headers(&message->hdrs);
                        if (php_output_get_level()) {
                                if (php_output_get_status() & PHP_OUTPUT_SENT) {
-                                       php_error_docref(NULL, E_WARNING, "Could not fetch response body, output has already been sent at %s:%d", php_output_get_start_filename(TSRMLS_C), php_output_get_start_lineno(TSRMLS_C));
+                                       php_error_docref(NULL, E_WARNING, "Could not fetch response body, output has already been sent at %s:%d", php_output_get_start_filename(), php_output_get_start_lineno());
                                        goto error;
                                } else if (SUCCESS != php_output_get_contents(&tval)) {
                                        php_error_docref(NULL, E_WARNING, "Could not fetch response body");
@@ -818,7 +818,7 @@ php_http_message_object_t *php_http_message_object_new_ex(zend_class_entry *ce,
        return o;
 }
 
-zend_object *php_http_message_object_clone(zval *this_ptr TSRMLS_DC)
+zend_object *php_http_message_object_clone(zval *this_ptr)
 {
        php_http_message_object_t *new_obj = NULL;
        php_http_message_object_t *old_obj = PHP_HTTP_OBJ(NULL, this_ptr);
@@ -1409,7 +1409,7 @@ static PHP_METHOD(HttpMessage, setResponseCode)
        zend_bool strict = 1;
        php_http_message_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|b", &code, &strict), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "l|b", &code, &strict), invalid_arg, return);
 
        obj = PHP_HTTP_OBJ(NULL, getThis());
        PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
@@ -1460,7 +1460,7 @@ static PHP_METHOD(HttpMessage, setResponseStatus)
        size_t status_len;
        php_http_message_object_t *obj;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &status, &status_len), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &status, &status_len), invalid_arg, return);
 
        obj = PHP_HTTP_OBJ(NULL, getThis());
 
@@ -1710,7 +1710,7 @@ static PHP_METHOD(HttpMessage, unserialize)
                        obj->message = msg;
                } else {
                        obj->message = php_http_message_init(NULL, 0, NULL);
-                       php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not unserialize http\\Message");
+                       php_error_docref(NULL, E_ERROR, "Could not unserialize http\\Message");
                }
        }
 }
@@ -1832,7 +1832,7 @@ static PHP_METHOD(HttpMessage, count)
 {
        zend_long count_mode = -1;
 
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &count_mode)) {
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &count_mode)) {
                php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis());
 
                PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
index 92c8e40..535a2b3 100644 (file)
@@ -596,7 +596,7 @@ static PHP_METHOD(HttpMessageParser, parse)
        size_t data_len;
        zend_long flags;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "slz", &data_str, &data_len, &flags, &zmsg), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "slz", &data_str, &data_len, &flags, &zmsg), invalid_arg, return);
 
        parser_obj = PHP_HTTP_OBJ(NULL, getThis());
        php_http_buffer_append(&parser_obj->buffer, data_str, data_len);
@@ -625,7 +625,7 @@ static PHP_METHOD(HttpMessageParser, stream)
        php_stream *s;
        zend_long flags;
 
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &zstream, &flags, &zmsg), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "rlz", &zstream, &flags, &zmsg), invalid_arg, return);
 
        zend_replace_error_handling(EH_THROW, php_http_exception_unexpected_val_class_entry, &zeh);
        php_stream_from_zval(s, zstream);
index 00b8d86..4adab81 100644 (file)
@@ -113,9 +113,9 @@ char *php_http_pretty_key(register char *key, size_t key_len, zend_bool uctitle,
 }
 
 
-size_t php_http_boundary(char *buf, size_t buf_len TSRMLS_DC)
+size_t php_http_boundary(char *buf, size_t buf_len)
 {
-       return snprintf(buf, buf_len, "%15.15F", sapi_get_request_time(TSRMLS_C) * php_combined_lcg(TSRMLS_C));
+       return snprintf(buf, buf_len, "%15.15F", sapi_get_request_time() * php_combined_lcg());
 }
 
 int php_http_select_str(const char *cmp, int argc, ...)
@@ -251,8 +251,8 @@ size_t php_http_pass_fcall_callback(void *cb_arg, const char *str, size_t len)
        zval zdata;
 
        ZVAL_STRINGL(&zdata, str, len);
-       if (SUCCESS == zend_fcall_info_argn(&fcd->fci TSRMLS_CC, 2, &fcd->fcz, &zdata)) {
-               zend_fcall_info_call(&fcd->fci, &fcd->fcc, NULL, NULL TSRMLS_CC);
+       if (SUCCESS == zend_fcall_info_argn(&fcd->fci, 2, &fcd->fcz, &zdata)) {
+               zend_fcall_info_call(&fcd->fci, &fcd->fcc, NULL, NULL);
                zend_fcall_info_args_clear(&fcd->fci, 0);
        }
        zval_ptr_dtor(&zdata);
index ede406f..d2410f8 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "php_http_api.h"
 
-static int php_http_negotiate_sort(const void *first, const void *second TSRMLS_DC)
+static int php_http_negotiate_sort(const void *first, const void *second)
 {
        zval result;
        Bucket *b1 = (Bucket *) first, *b2 = (Bucket *) second;
@@ -100,7 +100,7 @@ static int php_http_negotiate_reduce(zval *p, int num_args, va_list args, zend_h
        return ZEND_HASH_APPLY_KEEP;
 }
 
-HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable *supported, const char *primary_sep_str, size_t primary_sep_len TSRMLS_DC)
+HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable *supported, const char *primary_sep_str, size_t primary_sep_len)
 {
        HashTable *result = NULL;
 
@@ -115,7 +115,7 @@ HashTable *php_http_negotiate(const char *value_str, size_t value_len, HashTable
                php_http_params_opts_default_get(&opts);
                opts.input.str = estrndup(value_str, value_len);
                opts.input.len = value_len;
-               php_http_params_parse(&params, &opts TSRMLS_CC);
+               php_http_params_parse(&params, &opts);
                efree(opts.input.str);
 
                array_init(&arr);
index 586828f..44f1735 100644 (file)
@@ -119,7 +119,7 @@ static inline HashTable *php_http_negotiate_content_type(HashTable *supported, p
 #define PHP_HTTP_DO_NEGOTIATE(type, supported, rs_array) \
        { \
                HashTable *result; \
-               if ((result = php_http_negotiate_ ##type(supported, NULL TSRMLS_CC))) { \
+               if ((result = php_http_negotiate_ ##type(supported, NULL))) { \
                        PHP_HTTP_DO_NEGOTIATE_HANDLE_RESULT(result, supported, rs_array); \
                } else { \
                        PHP_HTTP_DO_NEGOTIATE_HANDLE_DEFAULT(supported, rs_array); \
index c6bd17f..20de8c8 100644 (file)
@@ -18,7 +18,7 @@ typedef struct php_http_object {
        zend_object zo;
 } php_http_object_t;
 
-zend_object *php_http_object_new(zend_class_entry *ce TSRMLS_DC);
+zend_object *php_http_object_new(zend_class_entry *ce);
 php_http_object_t *php_http_object_new_ex(zend_class_entry *ce, void *nothing);
 
 typedef void *(*php_http_new_t)(zend_class_entry *ce, void *);
index 68dfaf3..b6610cf 100644 (file)
@@ -315,7 +315,7 @@ static inline void sanitize_rfc5987(zval *zv, char **language, zend_bool *latin1
        }
 }
 
-static inline void sanitize_rfc5988(char *str, size_t len, zval *zv TSRMLS_DC)
+static inline void sanitize_rfc5988(char *str, size_t len, zval *zv)
 {
        zend_string *zs = zend_string_init(str, len, 0);
 
@@ -324,7 +324,7 @@ static inline void sanitize_rfc5988(char *str, size_t len, zval *zv TSRMLS_DC)
        zend_string_release(zs);
 }
 
-static inline void prepare_rfc5988(zval *zv TSRMLS_DC)
+static inline void prepare_rfc5988(zval *zv)
 {
        if (Z_TYPE_P(zv) != IS_STRING) {
                zval_dtor(zv);
@@ -437,7 +437,7 @@ static void merge_param(HashTable *params, zval *zdata, zval **current_param, zv
                zval tmp;
                INIT_PZVAL_ARRAY(&tmp, params);
                fprintf(stderr, "params = ");
-               zend_print_zval_r(&tmp, 1 TSRMLS_CC);
+               zend_print_zval_r(&tmp, 1);
                fprintf(stderr, "\n");
        }
 #endif
@@ -1225,7 +1225,7 @@ PHP_METHOD(HttpParams, offsetSet)
        zend_string *name;
        zval zparams_tmp, *zparam, *zparams, *nvalue;
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &name, &nvalue)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &name, &nvalue)) {
                return;
        }
 
index a77118c..589b015 100644 (file)
@@ -178,7 +178,7 @@ ZEND_RESULT_CODE php_http_querystring_parse(HashTable *ht, const char *str, size
        opts.val = vsepp;
        opts.flags = PHP_HTTP_PARAMS_QUERY;
 
-       if (SUCCESS == php_http_ini_entry(ZEND_STRL("arg_separator.input"), &asi_str, &asi_len, 0 TSRMLS_CC) && asi_len) {
+       if (SUCCESS == php_http_ini_entry(ZEND_STRL("arg_separator.input"), &asi_str, &asi_len, 0) && asi_len) {
                zval arr;
 
                array_init_size(&arr, asi_len);
@@ -329,7 +329,7 @@ PHP_METHOD(HttpQueryString, __construct)
        zval *params = NULL;
        zend_error_handling zeh;
        
-       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &params), invalid_arg, return);
+       php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &params), invalid_arg, return);
 
        zend_replace_error_handling(EH_THROW, php_http_exception_bad_querystring_class_entry, &zeh);
        php_http_querystring_set(getThis(), params, 0);
@@ -594,7 +594,7 @@ PHP_METHOD(HttpQueryString, offsetSet)
        zend_string *offset;
        zval *value, param, znull;
        
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sz", &offset, &value)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &offset, &value)) {
                return;
        }
 
@@ -641,7 +641,7 @@ PHP_METHOD(HttpQueryString, offsetUnset)
        zend_string *offset;
        zval param, znull;
        
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &offset)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) {
                return;
        }
 
index 18ac182..2c5d3f4 100644 (file)
@@ -839,7 +839,7 @@ static ZEND_RESULT_CODE parse_userinfo(struct parse_state *state, const char *pt
 
 #if defined(PHP_WIN32) || defined(HAVE_UIDNA_IDNTOASCII)
 typedef size_t (*parse_mb_func)(unsigned *wc, const char *ptr, const char *end);
-static ZEND_RESULT_CODE to_utf16(parse_mb_func fn, const char *u8, uint16_t **u16, size_t *len TSRMLS_DC)
+static ZEND_RESULT_CODE to_utf16(parse_mb_func fn, const char *u8, uint16_t **u16, size_t *len)
 {
        size_t offset = 0, u8_len = strlen(u8);
 
@@ -887,7 +887,6 @@ static ZEND_RESULT_CODE parse_idn2(struct parse_state *state, size_t prev_len)
 {
        char *idn = NULL;
        int rv = -1;
-       TSRMLS_FETCH_FROM_CTX(state->ts);
 
        if (state->flags & PHP_HTTP_URL_PARSE_MBUTF8) {
                rv = idn2_lookup_u8((const unsigned char *) state->url.host, (unsigned char **) &idn, IDN2_NFC_INPUT);
@@ -898,7 +897,7 @@ static ZEND_RESULT_CODE parse_idn2(struct parse_state *state, size_t prev_len)
        }
 #      endif
        if (rv != IDN2_OK) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse IDN; %s", idn2_strerror(rv));
+               php_error_docref(NULL, E_WARNING, "Failed to parse IDN; %s", idn2_strerror(rv));
                return FAILURE;
        } else {
                size_t idnlen = strlen(idn);
@@ -949,15 +948,14 @@ static ZEND_RESULT_CODE parse_uidn(struct parse_state *state)
        uint16_t *uhost_str, ahost_str[MAXHOSTNAMELEN], *ahost_ptr;
        size_t uhost_len, ahost_len;
        UErrorCode error = U_ZERO_ERROR;
-       TSRMLS_FETCH_FROM_CTX(state->ts);
 
        if (state->flags & PHP_HTTP_URL_PARSE_MBUTF8) {
-               if (SUCCESS != to_utf16(parse_mb_utf8, state->url.host, &uhost_str, &uhost_len TSRMLS_CC)) {
+               if (SUCCESS != to_utf16(parse_mb_utf8, state->url.host, &uhost_str, &uhost_len)) {
                        return FAILURE;
                }
 #ifdef PHP_HTTP_HAVE_WCHAR
        } else if (state->flags & PHP_HTTP_URL_PARSE_MBLOC) {
-               if (SUCCESS != to_utf16(parse_mb_loc, state->url.host, &uhost_str, &uhost_len TSRMLS_CC)) {
+               if (SUCCESS != to_utf16(parse_mb_loc, state->url.host, &uhost_str, &uhost_len)) {
                        return FAILURE;
                }
 #endif
@@ -1499,7 +1497,6 @@ php_http_url_t *php_http_url_parse_authority(const char *str, size_t len, unsign
        state->ptr = str;
        state->flags = flags;
        state->maxlen = maxlen;
-       TSRMLS_SET_CTX(state->ts);
 
        if (!(state->ptr = parse_authority(state))) {
                efree(state);
@@ -1507,7 +1504,7 @@ php_http_url_t *php_http_url_parse_authority(const char *str, size_t len, unsign
        }
 
        if (state->ptr != state->end) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+               php_error_docref(NULL, E_WARNING,
                                "Failed to parse URL authority, unexpected character at pos %u in '%s'",
                                (unsigned) (state->ptr - str), str);
                efree(state);
index 5e8008d..e763a85 100644 (file)
@@ -46,17 +46,17 @@ php_http_version_t *php_http_version_parse(php_http_version_t *v, const char *st
                        separator = *ptr++;
                        if (separator) {
                                if (separator != '.' && separator != ',') {
-                                       php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Non-standard version separator '%c' in HTTP protocol version '%s'", separator, ptr - 2);
+                                       php_error_docref(NULL, E_NOTICE, "Non-standard version separator '%c' in HTTP protocol version '%s'", separator, ptr - 2);
                                }
                                minor = *ptr - '0';
                                if (minor >= 0 && minor <= 9) {
-                                       return php_http_version_init(v, major, minor TSRMLS_CC);
+                                       return php_http_version_init(v, major, minor);
                                }
                        }
                }
        }
 
-       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not parse HTTP protocol version '%s'", str);
+       php_error_docref(NULL, E_WARNING, "Could not parse HTTP protocol version '%s'", str);
        return NULL;
 }
 
index d45d57b..6f51a47 100644 (file)
@@ -19,7 +19,7 @@ typedef struct php_http_version {
 } php_http_version_t;
 
 PHP_HTTP_API php_http_version_t *php_http_version_init(php_http_version_t *v, unsigned major, unsigned minor);
-PHP_HTTP_API php_http_version_t *php_http_version_parse(php_http_version_t *v, const char *str TSRMLS_DC);
+PHP_HTTP_API php_http_version_t *php_http_version_parse(php_http_version_t *v, const char *str);
 PHP_HTTP_API void php_http_version_to_string(php_http_version_t *v, char **str, size_t *len, const char *pre, const char *post);
 PHP_HTTP_API void php_http_version_dtor(php_http_version_t *v);
 PHP_HTTP_API void php_http_version_free(php_http_version_t **v);
index 1bafdc1..5f1c069 100644 (file)
@@ -9,6 +9,7 @@ skip_client_test();
 <?php
 
 include "helper/server.inc";
+include "helper/dump.inc";
 
 echo "Test\n";
 
@@ -22,23 +23,17 @@ server("proxy.inc", function($port) {
        $request->setOptions(array("timeout" => 10, "expect_100_timeout" => 0));
        $client->enqueue($request);
        $client->send();
-       var_dump($client->getResponse()->getHeaders());
+       dump_headers(null, $client->getResponse()->getHeaders());
 });
 
 ?>
 ===DONE===
 --EXPECTF--
 Test
-array(5) {
-  ["Accept-Ranges"]=>
-  string(5) "bytes"
-  ["Etag"]=>
-  string(%d) "%s"
-  ["Last-Modified"]=>
-  string(%d) "%s"
-  ["X-Original-Transfer-Encoding"]=>
-  string(7) "chunked"
-  ["Content-Length"]=>
-  int(134217%d%d%d)
-}
-===DONE===
+Accept-Ranges: bytes
+Content-Length: 134217960
+Etag: "cc048f13"
+Last-Modified: Mon, 20 Jul 2015 12:55:36 GMT
+X-Original-Transfer-Encoding: chunked
+
+===DONE===
\ No newline at end of file
index 5f5f367..452a715 100644 (file)
@@ -1,16 +1,22 @@
 <?php
 
-function dump_message($stream, http\Message $msg, $parent = false) {
+function dump_headers($stream, array $headers) {
        if (!is_resource($stream)) {
                $stream = fopen("php://output", "w");
        }
-       fprintf($stream, "%s\n", $msg->getInfo());
-       $headers = $msg->getHeaders();
        ksort($headers);
        foreach ($headers as $key => $val) {
                fprintf($stream, "%s: %s\n", $key, $val);
        }
        fprintf($stream, "\n");
+}
+
+function dump_message($stream, http\Message $msg, $parent = false) {
+       if (!is_resource($stream)) {
+               $stream = fopen("php://output", "w");
+       }
+       fprintf($stream, "%s\n", $msg->getInfo());
+       dump_headers($stream, $msg->getHeaders());
        $msg->getBody()->toStream($stream);
        
        if ($parent && ($msg = $msg->getParentMessage())) {
index 506e083..a13dc12 100644 (file)
@@ -10,6 +10,18 @@ if ($php) {
        define("PHP_BIN", PHP_BINDIR.DIRECTORY_SEPARATOR."php");
 }
 
+foreach (array("raphf", "propro", "http") as $ext) {
+       if (!extension_loaded($ext)) {
+               switch (PHP_SHLIB_SUFFIX) {
+                       case "dll":
+                               dl("php_$ext.dll"); 
+                               break;
+                       default:
+                               dl($ext .".". PHP_SHLIB_SUFFIX);
+               }
+       }
+}
+
 function serve($cb) {
        /* stream_socket_server() automatically sets SO_REUSEADDR, 
         * which is, well, bad if the tests are run in parallel