- use &EG(symbol_table)'s HTTP_SERVER_VARS instead of
authorMichael Wallner <mike@php.net>
Fri, 19 Aug 2005 07:50:54 +0000 (07:50 +0000)
committerMichael Wallner <mike@php.net>
Fri, 19 Aug 2005 07:50:54 +0000 (07:50 +0000)
  PG(http_globals)[TRACK_VARS_SERVER] as the latter might
  only be filled with register_long_arrays=On

http_api.c
http_headers_api.c
http_response_object.c
php_http_std_defs.h

index 8e683a1f31e1a201c03a63cd2d6e921a60351b10..de95a88e2da5d99e7b95e902d56109779a8ae4e9 100644 (file)
@@ -154,6 +154,7 @@ STATUS _http_parse_key_list(const char *list, HashTable *items, char separator,
 
        return SUCCESS;
 }
 
        return SUCCESS;
 }
+/* }}} */
 
 /* {{{ void http_error(long, long, char*) */
 void _http_error_ex(long type, long code, const char *format, ...)
 
 /* {{{ void http_error(long, long, char*) */
 void _http_error_ex(long type, long code, const char *format, ...)
@@ -214,15 +215,19 @@ STATUS _http_check_method_ex(const char *method, const char *methods)
 /* {{{ zval *http_get_server_var_ex(char *, size_t) */
 PHP_HTTP_API zval *_http_get_server_var_ex(const char *key, size_t key_size, zend_bool check TSRMLS_DC)
 {
 /* {{{ zval *http_get_server_var_ex(char *, size_t) */
 PHP_HTTP_API zval *_http_get_server_var_ex(const char *key, size_t key_size, zend_bool check TSRMLS_DC)
 {
+       zval **hsv;
        zval **var;
        zval **var;
-       if (SUCCESS == zend_hash_find(HTTP_SERVER_VARS, (char *) key, key_size, (void **) &var)) {
-               if (check) {
-                       return Z_STRVAL_PP(var) && Z_STRLEN_PP(var) ? *var : NULL;
-               } else {
-                       return *var;
-               }
+       
+       if (SUCCESS != zend_hash_find(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), (void **) &hsv)) {
+               return NULL;
+       }
+       if (SUCCESS != zend_hash_find(Z_ARRVAL_PP(hsv), (char *) key, key_size, (void **) &var)) {
+               return NULL;
+       }
+       if (check && !(Z_STRVAL_PP(var) && Z_STRLEN_PP(var))) {
+               return NULL;
        }
        }
-       return NULL;
+       return *var;
 }
 /* }}} */
 
 }
 /* }}} */
 
index 81a24e3856b61659f9bf149bc4c2964fd7244403..37e16cd2eb8b08f323678b31ea354887895eebab 100644 (file)
@@ -376,22 +376,24 @@ PHP_HTTP_API void _http_get_request_headers_ex(HashTable *headers, zend_bool pre
 {
        char *key = NULL;
        ulong idx = 0;
 {
        char *key = NULL;
        ulong idx = 0;
-       zval array;
+       zval array, **hsv;
 
        Z_ARRVAL(array) = headers;
 
 
        Z_ARRVAL(array) = headers;
 
-       FOREACH_HASH_KEY(HTTP_SERVER_VARS, key, idx) {
-               if (key && !strncmp(key, "HTTP_", 5)) {
-                       zval **header;
-
-                       key += 5;
-                       if (prettify) {
-                               key = pretty_key(key, strlen(key), 1, 1);
+       if (SUCCESS == zend_hash_find(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), (void **) &hsv)) {
+               FOREACH_KEY(*hsv, key, idx) {
+                       if (key && !strncmp(key, "HTTP_", 5)) {
+                               zval **header;
+       
+                               key += 5;
+                               if (prettify) {
+                                       key = pretty_key(key, strlen(key), 1, 1);
+                               }
+       
+                               zend_hash_get_current_data(Z_ARRVAL_PP(hsv), (void **) &header);
+                               add_assoc_stringl(&array, key, Z_STRVAL_PP(header), Z_STRLEN_PP(header), 1);
+                               key = NULL;
                        }
                        }
-
-                       zend_hash_get_current_data(HTTP_SERVER_VARS, (void **) &header);
-                       add_assoc_stringl(&array, key, Z_STRVAL_PP(header), Z_STRLEN_PP(header), 1);
-                       key = NULL;
                }
        }
 }
                }
        }
 }
index f4528f828252390421b0d64f83ba2cf1a9079c4d..c9e71a9aa68a32001fd985304c618c6beacd289e 100644 (file)
@@ -780,7 +780,7 @@ PHP_METHOD(HttpResponse, send)
        if (Z_LVAL_P(GET_STATIC_PROP(gzip))) {
                php_start_ob_buffer_named("ob_gzhandler", 0, 1 TSRMLS_CC);
        } else {
        if (Z_LVAL_P(GET_STATIC_PROP(gzip))) {
                php_start_ob_buffer_named("ob_gzhandler", 0, 1 TSRMLS_CC);
        } else {
-               php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC);
+               php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
        }
 
        /* caching */
        }
 
        /* caching */
index fac59a3c3203ca745aeb09e31f5188f1b08371c3..1e117b9da25626d51f422adbe26cfae208da9a07 100644 (file)
@@ -105,9 +105,6 @@ typedef int STATUS;
                /* END */
 
 
                /* END */
 
 
-/* server vars shorthand */
-#define HTTP_SERVER_VARS Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])
-
 #define HTTP_PHP_INI_ENTRY(entry, default, scope, updater, global) \
        STD_PHP_INI_ENTRY(entry, default, scope, updater, global, zend_http_globals, http_globals)
 
 #define HTTP_PHP_INI_ENTRY(entry, default, scope, updater, global) \
        STD_PHP_INI_ENTRY(entry, default, scope, updater, global, zend_http_globals, http_globals)