- send a content-length header if we send the full plain data
[m6w6/ext-http] / http.c
diff --git a/http.c b/http.c
index 548c39158bf64d901389b0620d808ab26d089287..2ecaa58edb9e6fa1724066aaae02506c50d8f37a 100644 (file)
--- a/http.c
+++ b/http.c
@@ -29,7 +29,9 @@
 #include "php_http_std_defs.h"
 #include "php_http_api.h"
 #include "php_http_send_api.h"
-#include "php_http_request_api.h"
+#ifdef HTTP_HAVE_CURL
+#      include "php_http_request_api.h"
+#endif
 
 #ifdef ZEND_ENGINE_2
 #      include "php_http_util_object.h"
@@ -81,6 +83,7 @@ function_entry http_functions[] = {
        PHP_FE(http_send_file, NULL)
        PHP_FE(http_send_stream, NULL)
        PHP_FE(http_chunked_decode, NULL)
+       PHP_FE(http_parse_message, NULL)
        PHP_FE(http_split_response, NULL)
        PHP_FE(http_parse_headers, NULL)
        PHP_FE(http_get_request_headers, NULL)
@@ -216,6 +219,8 @@ PHP_MINIT_FUNCTION(http)
        http_exception_object_init();
 #endif /* ZEND_ENGINE_2 */
 
+       zend_hash_init_ex(&http_response_statics, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1, 0);
+       zend_fix_static_properties(http_response_object_ce, &http_response_statics TSRMLS_CC);
        return SUCCESS;
 }
 /* }}} */
@@ -223,6 +228,7 @@ PHP_MINIT_FUNCTION(http)
 /* {{{ PHP_MSHUTDOWN_FUNCTION */
 PHP_MSHUTDOWN_FUNCTION(http)
 {
+       zend_hash_destroy(&http_response_statics);
        UNREGISTER_INI_ENTRIES();
 #ifdef HTTP_HAVE_CURL
        curl_global_cleanup();
@@ -241,6 +247,7 @@ PHP_RINIT_FUNCTION(http)
        }
 
        http_globals_init(HTTP_GLOBALS);
+       zend_init_static_properties(http_response_object_ce, &http_response_statics TSRMLS_CC);
        return SUCCESS;
 }
 /* }}} */
@@ -248,6 +255,7 @@ PHP_RINIT_FUNCTION(http)
 /* {{{ PHP_RSHUTDOWN_FUNCTION */
 PHP_RSHUTDOWN_FUNCTION(http)
 {
+       zend_clean_static_properties(http_response_object_ce TSRMLS_CC);
        http_globals_free(HTTP_GLOBALS);
        return SUCCESS;
 }
@@ -286,6 +294,7 @@ PHP_MINFO_FUNCTION(http)
        }
        php_info_print_table_end();
 
+#ifdef HTTP_HAVE_CURL
        php_info_print_table_start();
        {
                unsigned i;
@@ -314,6 +323,7 @@ PHP_MINFO_FUNCTION(http)
                phpstr_free(custom_request_methods);
        }
        php_info_print_table_end();
+#endif
 
        php_info_print_table_start();
        {