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

admin: Making Etag a header, not a trailer #6208

Merged
merged 8 commits into from
Apr 11, 2024

Conversation

jadidbourbaki
Copy link
Contributor

This is based on @mholt's comment on an earlier PR.

I have used the very simple approach suggested by an earlier comment of first writing to a buffer, and then writing the buffer onto the response writer so as to have time to write the eTag as the header.

This probably requires some iterations. I would be grateful for suggestions by reviewers and the community on testing this out / making the implementation better.

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This LGTM.

The only thing I would consider is adding a backdoor pool for the buffer. Would you like to do that in this PR? We can always do it later too.

PS. Your contribution is quite timely, here's a complaint from someone about the lack of Trailer support in clients:

https://twitter.com/fredkisss/status/1774726559066177560

Regarding this PR (and the config in the docs), I wanted to inform that it seems like the Trailer header is not well supported by many languages.

I am writing an app in python that needs to interface with caddy config API and I want to handle concurrent requests to caddy config API, but it seems like there is no http lib in python that supports reading it, so I am at lost.

I even tried to do in JS, but it isn't supported by browsers at all have been removed from the fetch spec (API that is used in JS to make http requests).

What I have noticed is a lack of any library, browser or language wanting to support http trailers in response the body.

I'm a little bummed that Trailer support is so lacking still in 2024 :( Here's to a less efficient server API 🥂

@jadidbourbaki
Copy link
Contributor Author

Thanks! I have added a backdoor... err, I mean a sync.Pool. Please let me know if there are any implementation mistakes. Thank you.

admin.go Outdated Show resolved Hide resolved
admin.go Outdated Show resolved Hide resolved
admin.go Outdated Show resolved Hide resolved
@francislavoie francislavoie added the bug 🐞 Something isn't working label Apr 2, 2024
@francislavoie francislavoie added this to the v2.8.0 milestone Apr 2, 2024
@francislavoie francislavoie changed the title Making eTags a header not a trailer admin: Making Etag a header, not a trailer Apr 2, 2024
@otbutz
Copy link

otbutz commented Apr 3, 2024

PS. Your contribution is quite timely, here's a complaint from someone about the lack of Trailer support in clients:

Not only in clients: quic-go/quic-go#2266

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for using a buffer pool and commenting the code.

@mholt mholt enabled auto-merge (squash) April 11, 2024 21:11
@mholt mholt merged commit 4a0492f into caddyserver:master Apr 11, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants