Skip to content

HttpResponseWriterPtr无法响应http2请求 #320

Open
@oioitff

Description

@oioitff

测试代码如下:

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请求

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions