X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=php_http_env.c;h=3ca996f43fabff7a34bdfcc36035955c47c37b2b;hb=64722314d70dc547e477d87927c22b598aa463d0;hp=f73be2053eb8815331df6dcbffff6f5c931cf5e2;hpb=8440085bc06a0b6edc7363155abf7b54e861455c;p=m6w6%2Fext-http diff --git a/php_http_env.c b/php_http_env.c index f73be20..3ca996f 100644 --- a/php_http_env.c +++ b/php_http_env.c @@ -663,6 +663,8 @@ PHP_HTTP_BEGIN_ARGS(getResponseStatusForCode, 1) PHP_HTTP_ARG_VAL(code, 0) PHP_HTTP_END_ARGS; +PHP_HTTP_EMPTY_ARGS(getResponseStatusForAllCodes); + PHP_HTTP_BEGIN_ARGS(getResponseHeader, 0) PHP_HTTP_ARG_VAL(header_name, 0) PHP_HTTP_END_ARGS; @@ -726,6 +728,7 @@ static zend_function_entry php_http_env_method_entry[] = { PHP_HTTP_ENV_ME(getRequestBody) PHP_HTTP_ENV_ME(getResponseStatusForCode) + PHP_HTTP_ENV_ME(getResponseStatusForAllCodes) PHP_HTTP_ENV_ME(getResponseHeader) PHP_HTTP_ENV_ME(getResponseCode) @@ -793,6 +796,25 @@ PHP_METHOD(HttpEnv, getResponseStatusForCode) RETURN_FALSE; } +PHP_METHOD(HttpEnv, getResponseStatusForAllCodes) +{ + const char *s; + unsigned c; + php_http_strlist_iterator_t i; + + if (SUCCESS != zend_parse_parameters_none()) { + RETURN_FALSE; + } + + array_init(return_value); + for ( php_http_strlist_iterator_init(&i, php_http_env_response_status, 100); + *(s = php_http_strlist_iterator_this(&i, &c)); + php_http_strlist_iterator_next(&i) + ) { + add_index_string(return_value, c, s, 1); + } +} + PHP_METHOD(HttpEnv, getResponseHeader) { char *header_name_str = NULL;