X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_env.c;h=74194c43a929c8dba1c014da1aa6f64ce3235520;hp=f73be2053eb8815331df6dcbffff6f5c931cf5e2;hb=25f0c16244fc5f8b2c9d9bfddab8a541d2521789;hpb=8440085bc06a0b6edc7363155abf7b54e861455c diff --git a/php_http_env.c b/php_http_env.c index f73be20..74194c4 100644 --- a/php_http_env.c +++ b/php_http_env.c @@ -4,7 +4,7 @@ +--------------------------------------------------------------------+ | Redistribution and use in source and binary forms, with or without | | modification, are permitted provided that the conditions mentioned | - | in the accomp395anying LICENSE file are met. | + | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ | Copyright (c) 2004-2011, Michael Wallner | +--------------------------------------------------------------------+ @@ -417,7 +417,7 @@ PHP_HTTP_API STATUS php_http_env_get_response_headers(HashTable *headers_ht TSRM zend_llist_apply_with_argument(&SG(sapi_headers).headers, grab_headers, &headers TSRMLS_CC); php_http_buffer_fix(&headers); - status = php_http_headers_parse(PHP_HTTP_BUFFER_VAL(&headers), PHP_HTTP_BUFFER_LEN(&headers), headers_ht, NULL, NULL TSRMLS_CC); + status = php_http_headers_parse(headers.data, headers.used, headers_ht, NULL, NULL TSRMLS_CC); php_http_buffer_dtor(&headers); return status; @@ -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; @@ -965,7 +987,7 @@ PHP_METHOD(HttpEnv, cleanPersistentHandles) static SAPI_POST_HANDLER_FUNC(php_http_json_post_handler) { if (SG(request_info).raw_post_data) { - php_json_decode_ex(arg, SG(request_info).raw_post_data, SG(request_info).raw_post_data_length, PHP_JSON_OBJECT_AS_ARRAY, PG(max_input_nesting_level) TSRMLS_CC); + php_json_decode(arg, SG(request_info).raw_post_data, SG(request_info).raw_post_data_length, 1, PG(max_input_nesting_level) TSRMLS_CC); } }