mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
httpparser: fix it
This commit is contained in:
parent
c591f130c6
commit
8b0269a3cb
7
php_uv.c
7
php_uv.c
@ -6317,19 +6317,22 @@ PHP_FUNCTION(uv_http_parser_execute)
|
|||||||
http_parser_execute(&context->parser, &context->settings, body, body_len);
|
http_parser_execute(&context->parser, &context->settings, body, body_len);
|
||||||
|
|
||||||
if (context->finished == 1) {
|
if (context->finished == 1) {
|
||||||
|
zval *headers = NULL;
|
||||||
if (result) {
|
if (result) {
|
||||||
zval_dtor(result);
|
zval_dtor(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZVAL_ZVAL(result, context->data, 1, 0);
|
ZVAL_ZVAL(result, context->data, 1, 0);
|
||||||
|
|
||||||
if (context->is_response == 0) {
|
if (context->is_response == 0) {
|
||||||
add_assoc_string(result, "REQUEST_METHOD", (char*)http_method_str(context->parser.method), 1);
|
add_assoc_string(result, "REQUEST_METHOD", (char*)http_method_str(context->parser.method), 1);
|
||||||
} else {
|
} else {
|
||||||
add_assoc_long(result, "status_code", (long)context->parser.status_code);
|
add_assoc_long(result, "status_code", (long)context->parser.status_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_assoc_zval(result, "headers", context->headers);
|
MAKE_STD_ZVAL(headers);
|
||||||
|
ZVAL_ZVAL(headers, context->headers, 1, 0);
|
||||||
|
|
||||||
|
add_assoc_zval(result, "headers", headers);
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
} else {
|
} else {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user