mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +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);
|
||||
|
||||
if (context->finished == 1) {
|
||||
zval *headers = NULL;
|
||||
if (result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
|
||||
ZVAL_ZVAL(result, context->data, 1, 0);
|
||||
|
||||
if (context->is_response == 0) {
|
||||
add_assoc_string(result, "REQUEST_METHOD", (char*)http_method_str(context->parser.method), 1);
|
||||
} else {
|
||||
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;
|
||||
} else {
|
||||
RETURN_FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user