From 1e907e99b5e146a560ec31eb791d9716b712f6e7 Mon Sep 17 00:00:00 2001 From: chungthuang Date: Mon, 13 Oct 2025 13:26:47 -0500 Subject: [PATCH] TUN-9910: Make the metadata key to carry HTTP status over QUIC transport a constant --- connection/quic_connection.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/connection/quic_connection.go b/connection/quic_connection.go index 1ca5647e..88d1e7a2 100644 --- a/connection/quic_connection.go +++ b/connection/quic_connection.go @@ -33,6 +33,8 @@ const ( HTTPMethodKey = "HttpMethod" // HTTPHostKey is used to get or set http host in QUIC ALPN if the underlying proxy connection type is HTTP. HTTPHostKey = "HttpHost" + // HTTPStatus is used to return http status code in QUIC ALPN if the underlying proxy connection type is HTTP. + HTTPStatus = "HttpStatus" QUICMetadataFlowID = "FlowID" ) @@ -287,7 +289,7 @@ func (hrw *httpResponseAdapter) AddTrailer(trailerName, trailerValue string) { func (hrw *httpResponseAdapter) WriteRespHeaders(status int, header http.Header) error { metadata := make([]pogs.Metadata, 0) - metadata = append(metadata, pogs.Metadata{Key: "HttpStatus", Val: strconv.Itoa(status)}) + metadata = append(metadata, pogs.Metadata{Key: HTTPStatus, Val: strconv.Itoa(status)}) for k, vv := range header { for _, v := range vv { httpHeaderKey := fmt.Sprintf("%s:%s", HTTPHeaderKey, k) @@ -327,7 +329,7 @@ func (hrw *httpResponseAdapter) Hijack() (net.Conn, *bufio.ReadWriter, error) { } func (hrw *httpResponseAdapter) WriteErrorResponse(err error) { - _ = hrw.WriteConnectResponseData(err, pogs.Metadata{Key: "HttpStatus", Val: strconv.Itoa(http.StatusBadGateway)}) + _ = hrw.WriteConnectResponseData(err, pogs.Metadata{Key: HTTPStatus, Val: strconv.Itoa(http.StatusBadGateway)}) } func (hrw *httpResponseAdapter) WriteConnectResponseData(respErr error, metadata ...pogs.Metadata) error {