X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_api.c;h=de95a88e2da5d99e7b95e902d56109779a8ae4e9;hp=8e683a1f31e1a201c03a63cd2d6e921a60351b10;hb=13197bcea39d3425d021ee9a03e08ae5381ce296;hpb=b08947e98f1832091c8a9f6dea3799e0524d2822 diff --git a/http_api.c b/http_api.c index 8e683a1..de95a88 100644 --- a/http_api.c +++ b/http_api.c @@ -154,6 +154,7 @@ STATUS _http_parse_key_list(const char *list, HashTable *items, char separator, return SUCCESS; } +/* }}} */ /* {{{ 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 **hsv; 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; } /* }}} */