Skip to content

Conversation

@joaoprocopio
Copy link

i'm a huge fan of this library, everything about this library makes creating network services extremely pleasant.

as cited in the rfc 2616 "keep-alive" is a hop-by-hop header and shouldn't be forwarded to the upstream.
in my case i'm building a reverse proxy service and i need to prevent this headers from being cached and sent to the upstream, and it would be great to have this header that is needed to be treated inside the enum.

currently i'm just using this workaround.

const RFC_2616_HOP_BY_HOP_HEADERS: LazyLock<[HeaderName; 8]> = LazyLock::new(|| {
    [
        header::CONNECTION,
        header::HeaderName::from_static("keep-alive"),
        header::PROXY_AUTHENTICATE,
        header::PROXY_AUTHORIZATION,
        header::TE,
        header::TRAILER,
        header::TRANSFER_ENCODING,
        header::UPGRADE,
    ]
});

but this code could be simpler. (pretty irrelevant, but ok)

const RFC_2616_HOP_BY_HOP_HEADERS: &[HeaderName] = &[
        header::CONNECTION,
        header::KEEP_ALIVE,
        header::PROXY_AUTHENTICATE,
        header::PROXY_AUTHORIZATION,
        header::TE,
        header::TRAILER,
        header::TRANSFER_ENCODING,
        header::UPGRADE,
];

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

Successfully merging this pull request may close these issues.

1 participant