remove rinit and json dep in favor of pecl/json_post and pecl/apfd
authorMichael Wallner <mike@php.net>
Mon, 2 Mar 2015 14:58:58 +0000 (15:58 +0100)
committerMichael Wallner <mike@php.net>
Mon, 2 Mar 2015 14:58:58 +0000 (15:58 +0100)
config9.m4
package.xml
php_http.c
php_http_api.h
php_http_env.c
php_http_env.h

index ec202b685e00c9dc70658050dbe3e7015129356b..0e5e1ce7dfc5e80e8c198b75d23b5a348e3fa56f 100644 (file)
@@ -510,12 +510,6 @@ dnl ----
                fi
        ])
 
-dnl ----
-dnl JSON
-dnl ----
-       HTTP_HAVE_PHP_EXT([json])
-
-
 dnl ----
 dnl ICONV
 dnl ----
@@ -560,7 +554,6 @@ dnl ----
        dnl shared extension deps
        HTTP_SHARED_DEP([hash])
        HTTP_SHARED_DEP([iconv])
-       HTTP_SHARED_DEP([json])
        
        dnl extension deps
        PHP_ADD_EXTENSION_DEP([http], [raphf], true)
index c406bca44af637c3c9e665f3e9fad79f0fff00e3..447de8a49528b200402baec912412fe815af9b80 100644 (file)
@@ -23,12 +23,10 @@ It provides powerful request functionality with support for
 parallel requests.
 
 Documentation:
-v1: http://php.net/http
-v2: http://devel-m6w6.rhcloud.com/mdref/http
+http://devel-m6w6.rhcloud.com/mdref/http
 
 Code Coverage:
-v1: http://dev.iworks.at/ext-http/lcov_html/ext/http/
-v2: http://dev.iworks.at/ext-http/lcov/ext/http/
+http://dev.iworks.at/ext-http/lcov/ext/http/
 
 ]]></description>
  <lead>
@@ -349,7 +347,6 @@ v2: http://dev.iworks.at/ext-http/lcov/ext/http/
   <optional>
    <extension><name>hash</name></extension>
    <extension><name>iconv</name></extension>
-   <extension><name>json</name></extension>
   </optional>
  </dependencies>
  <providesextension>http</providesextension>
index 17d9925b5af8d3b01409b613aeb2dca69f76545b..bd7baff1078fffbad0a4cb5bd1b3e7be73b6c497 100644 (file)
@@ -44,7 +44,6 @@ zend_function_entry http_functions[] = {
 
 PHP_MINIT_FUNCTION(http);
 PHP_MSHUTDOWN_FUNCTION(http);
-PHP_RINIT_FUNCTION(http);
 PHP_RSHUTDOWN_FUNCTION(http);
 PHP_MINFO_FUNCTION(http);
 
@@ -57,9 +56,6 @@ static zend_module_dep http_module_deps[] = {
 #endif
 #ifdef PHP_HTTP_HAVE_ICONV
        ZEND_MOD_REQUIRED("iconv")
-#endif
-#ifdef PHP_HTTP_HAVE_JSON
-       ZEND_MOD_REQUIRED("json")
 #endif
        {NULL, NULL, NULL, 0}
 };
@@ -72,7 +68,7 @@ zend_module_entry http_module_entry = {
        http_functions,
        PHP_MINIT(http),
        PHP_MSHUTDOWN(http),
-       PHP_RINIT(http),
+       NULL,
        PHP_RSHUTDOWN(http),
        PHP_MINFO(http),
        PHP_PECL_HTTP_VERSION,
@@ -185,17 +181,6 @@ PHP_MSHUTDOWN_FUNCTION(http)
        return SUCCESS;
 }
 
-PHP_RINIT_FUNCTION(http)
-{
-       if (0
-       || SUCCESS != PHP_RINIT_CALL(http_env)
-       ) {
-               return FAILURE;
-       }
-       
-       return SUCCESS;
-}
-
 PHP_RSHUTDOWN_FUNCTION(http)
 {
        if (0
index 00a09aebc4c23190cc80f1f2787c4f18936bc2ac..ec18293dc125d9c2e7930a6a4eb29c86de69d7a2 100644 (file)
@@ -52,10 +52,6 @@ typedef int STATUS;
 #      define PHP_HTTP_HAVE_HASH
 #endif
 
-#if (defined(HAVE_JSON) || defined(PHP_HTTP_HAVE_EXT_JSON)) && (PHP_HTTP_SHARED_DEPS || !defined(COMPILE_DL_JSON))
-#      define PHP_HTTP_HAVE_JSON
-#endif
-
 #include <stddef.h>
 
 #ifdef PHP_WIN32
index 6de5ecb90a5ad419b8f098bb16dc31e1287a341c..f06769cc5e267889aa480b59e5be92c20fb722d9 100644 (file)
 #include "php_http_api.h"
 #include "php_variables.h"
 
-PHP_RINIT_FUNCTION(http_env)
-{
-       /* populate form data on non-POST requests */
-       if (SG(request_info).request_method && strcasecmp(SG(request_info).request_method, "POST") && SG(request_info).content_type && *SG(request_info).content_type) {
-               uint ct_len = strlen(SG(request_info).content_type);
-               char *ct_str = estrndup(SG(request_info).content_type, ct_len);
-               php_http_params_opts_t opts;
-               HashTable params;
-
-               php_http_params_opts_default_get(&opts);
-               opts.input.str = ct_str;
-               opts.input.len = ct_len;
-
-               SG(request_info).content_type_dup = ct_str;
-
-               ZEND_INIT_SYMTABLE(&params);
-               if (php_http_params_parse(&params, &opts TSRMLS_CC)) {
-                       char *key_str;
-                       uint key_len;
-                       ulong key_num;
-
-                       if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(&params, &key_str, &key_len, &key_num, 0, NULL)) {
-                               sapi_post_entry *post_entry = NULL;
-
-                               if (SUCCESS == zend_hash_find(&SG(known_post_content_types), key_str, key_len, (void *) &post_entry)) {
-                                       zval *files = PG(http_globals)[TRACK_VARS_FILES];
-
-                                       if (post_entry) {
-                                               SG(request_info).post_entry = post_entry;
-
-                                               if (post_entry->post_reader) {
-                                                       post_entry->post_reader(TSRMLS_C);
-                                               }
-                                       }
-
-                                       if (sapi_module.default_post_reader) {
-                                               sapi_module.default_post_reader(TSRMLS_C);
-                                       }
-
-                                       sapi_handle_post(PG(http_globals)[TRACK_VARS_POST] TSRMLS_CC);
-
-                                       /*
-                                        * the rfc1867 handler is an awkward buddy
-                                        */
-                                       if (files != PG(http_globals)[TRACK_VARS_FILES] && PG(http_globals)[TRACK_VARS_FILES]) {
-                                               Z_ADDREF_P(PG(http_globals)[TRACK_VARS_FILES]);
-                                               zend_hash_update(&EG(symbol_table), "_FILES", sizeof("_FILES"), &PG(http_globals)[TRACK_VARS_FILES], sizeof(zval *), NULL);
-                                               if (files) {
-                                                       zval_ptr_dtor(&files);
-                                               }
-                                       }
-                               }
-                       }
-                       zend_hash_destroy(&params);
-               }
-       }
-
-       PTR_SET(SG(request_info).content_type_dup, NULL);
-
-       return SUCCESS;
-}
-
 PHP_RSHUTDOWN_FUNCTION(http_env)
 {
        if (PHP_HTTP_G->env.request.headers) {
@@ -858,58 +796,6 @@ static zend_function_entry php_http_env_methods[] = {
        EMPTY_FUNCTION_ENTRY
 };
 
-#ifdef PHP_HTTP_HAVE_JSON
-#include "ext/json/php_json.h"
-
-static SAPI_POST_HANDLER_FUNC(php_http_json_post_handler)
-{
-       zval *zarg = arg;
-       char *json_str = NULL;
-       size_t json_len = 0;
-
-#if PHP_VERSION_ID >= 50600
-       if (SG(request_info).request_body) {
-               /* FG(stream_wrappers) not initialized yet, so we cannot use php://input */
-               php_stream_rewind(SG(request_info).request_body);
-               json_len = php_stream_copy_to_mem(SG(request_info).request_body, &json_str, PHP_STREAM_COPY_ALL, 0);
-       }
-#else
-       json_str = SG(request_info).raw_post_data;
-       json_len = SG(request_info).raw_post_data_length;
-#endif
-
-       if (json_len) {
-               zval zjson;
-
-               INIT_ZVAL(zjson);
-               php_json_decode(&zjson, json_str, json_len, 1, PG(max_input_nesting_level) TSRMLS_CC);
-               if (Z_TYPE(zjson) != IS_NULL) {
-                       zval_dtor(zarg);
-                       ZVAL_COPY_VALUE(zarg, (&zjson));
-               }
-       }
-#if PHP_VERSION_ID >= 50600
-       PTR_FREE(json_str);
-#endif
-}
-
-static void php_http_env_register_json_handler(TSRMLS_D)
-{
-       sapi_post_entry entry = {NULL, 0, NULL, NULL};
-
-       entry.post_reader = sapi_read_standard_form_data;
-       entry.post_handler = php_http_json_post_handler;
-
-       entry.content_type = "text/json";
-       entry.content_type_len = lenof("text/json");
-       sapi_register_post_entry(&entry TSRMLS_CC);
-
-       entry.content_type = "application/json";
-       entry.content_type_len = lenof("application/json");
-       sapi_register_post_entry(&entry TSRMLS_CC);
-}
-#endif
-
 zend_class_entry *php_http_env_class_entry;
 
 PHP_MINIT_FUNCTION(http_env)
@@ -919,10 +805,6 @@ PHP_MINIT_FUNCTION(http_env)
        INIT_NS_CLASS_ENTRY(ce, "http", "Env", php_http_env_methods);
        php_http_env_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
 
-#ifdef PHP_HTTP_HAVE_JSON
-       php_http_env_register_json_handler(TSRMLS_C);
-#endif
-
        return SUCCESS;
 }
 
index 7556c3efb68e77e4de0129d1ab18b1e0aeffe3aa..3b8d87f31a457710dda2b524c474f39be73c92ea 100644 (file)
@@ -73,7 +73,6 @@ PHP_HTTP_API zval *php_http_env_get_superglobal(const char *key, size_t key_len
 
 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);
 
 #endif