From 8b86b44ada511935dd1fb1bd7a2ed3d9c2489f0a Mon Sep 17 00:00:00 2001 From: matyhtf Date: Thu, 28 Jul 2016 13:12:58 +0800 Subject: [PATCH] fixed #787, compile failed with --enable-http2 --- swoole_http_v2_server.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/swoole_http_v2_server.c b/swoole_http_v2_server.c index bcbea68..b04ffd7 100644 --- a/swoole_http_v2_server.c +++ b/swoole_http_v2_server.c @@ -30,7 +30,7 @@ static sw_inline void http2_add_header(nghttp2_nv *headers, char *k, int kl, cha headers->valuelen = vl; } -static void http2_onRequest(http_context *ctx TSRMLS_DC) +static sw_inline void http2_onRequest(http_context *ctx, int server_fd TSRMLS_DC) { zval *retval; zval **args[2]; @@ -41,7 +41,8 @@ static void http2_onRequest(http_context *ctx TSRMLS_DC) args[0] = &zrequest_object; args[1] = &zresponse_object; - if (sw_call_user_function_ex(EG(function_table), NULL, php_sw_http_server_callbacks[HTTP_CALLBACK_onRequest], &retval, 2, args, 0, NULL TSRMLS_CC) == FAILURE) + zval *zcallback = php_swoole_server_get_callback(SwooleG.serv, server_fd, SW_SERVER_CB_onRequest); + if (sw_call_user_function_ex(EG(function_table), NULL, zcallback, &retval, 2, args, 0, NULL TSRMLS_CC) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "onRequest handler error"); } @@ -509,7 +510,7 @@ int swoole_http2_onFrame(swoole_http_client *client, swEventData *req) if (flags & SW_HTTP2_FLAG_END_STREAM) { - http2_onRequest(ctx TSRMLS_CC); + http2_onRequest(ctx, req->info.from_fd TSRMLS_CC); } else { @@ -557,7 +558,7 @@ int swoole_http2_onFrame(swoole_http_client *client, swEventData *req) swoole_php_fatal_error(E_WARNING, "parse multipart body failed."); } } - http2_onRequest(ctx TSRMLS_CC); + http2_onRequest(ctx, req->info.from_fd TSRMLS_CC); } } else if (type == SW_HTTP2_TYPE_PING)