Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpResponseWriterPtr无法响应http2请求 #320

Open
oioitff opened this issue Dec 4, 2022 · 2 comments
Open

HttpResponseWriterPtr无法响应http2请求 #320

oioitff opened this issue Dec 4, 2022 · 2 comments

Comments

@oioitff
Copy link

oioitff commented Dec 4, 2022

测试代码如下:

int main() {
    hv::HttpService router;
    router.GET("/", [](const HttpRequestPtr& req, const HttpResponseWriterPtr& writer) {
        writer->Begin();
        writer->WriteStatus(HTTP_STATUS_OK);
        writer->WriteHeader("Content-Type", "text/html");
        writer->WriteBody("hello world");
        writer->End();
    });

    hssl_ctx_init_param_t param;
    memset(&param, 0, sizeof(param));
    param.crt_file = "cert.crt";
    param.key_file = "key.pem";
    param.endpoint = HSSL_SERVER;
    if (hssl_ctx_init(&param) == NULL) {
        printf("hssl_ctx_init failed!\n");
        return -1;
    }

    hv::HttpServer server;
    server.registerHttpService(&router);
    server.setPort(0, 443);
    server.run();
    return 0;
}

用同步http_sync_handler是可以正常响应http2请求的,但是无论是用http_async_handler还是http_ctx_handler,都无法正常响应http2请求

@ithewei
Copy link
Owner

ithewei commented Dec 5, 2022

HttpResponseWriter确实没考虑http2协议,所以目前不支持http2的异步响应。

@cxyxiaoli
Copy link
Contributor

您好,请教一下,有libhv使用http2 server的使用example吗?
回调时是否支持不同的steam_id?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants