Skip to content

[Bug]: [http3]关闭连接时未有自动发送 GOAWAY 优雅关闭API #841

Description

@qisefengzheng

What happened?

RFC 9114 §3.3 要求:当任一端点选择关闭 HTTP/3 连接时,发起方 SHOULD 先发送 GOAWAY 帧,以便双方可靠判断已发送的帧是否已被处理。xquic 提供了 xqc_h3_stream_send_goaway API,但 xqc_h3_conn_close 函数直接调用 xqc_conn_close,不自动先发送 GOAWAY。

xquic\src\http3\xqc_h3_stream.c:627-635xqc_h3_stream_send_goaway提供了 GOAWAY 发送能力但未在关闭路径中调用。 上层应用若直接调用xqc_h3_conn_close关闭连接,对端将收到 CONNECTION_CLOSE 帧而非 GOAWAY,无法可靠判断之前发送的请求是否已被处理,可能导致请求丢失或重复处理。应用必须显式调用xqc_h3_stream_send_goaway后再调用xqc_h3_conn_close`,缺少便利的"优雅关闭" API。

nghttp3 提供 nghttp3_conn_submit_shutdown_noticenghttp3_conn.c:2605-2628)和 nghttp3_conn_shutdownnghttp3_conn.c:2630-2655)便利 API,引导应用正确执行优雅关闭流程。虽然 nghttp3 也不自动在 ngtcp2_conn_write_connection_close 时发送 GOAWAY,但 API 设计更明确。

Steps To Reproduce

Information and Steps to reproduce the behavior.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions