[go: up one dir, main page]

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

Add support for prefer_precompressed to FileServer #6284

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

3v0k4
Copy link
@3v0k4 3v0k4 commented Apr 30, 2024

Fixes #5116

Todos:

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@3v0k4
Copy link
Author
3v0k4 commented Apr 30, 2024

@francislavoie @mholt

This is still a spike as I'm trying to understand how we want to approach this before I do things properly.

Currently, I added a couple of if preferPrecompressed before the normal flow: the first one checks directly for the compressed file according to the client's accepted encodings and the second one looks for all the possible compressed files and, if one is found, uncompresses it.

I left the rest of the code because it takes care of the index files and browse. But we may want to consolidate things a bit more.

Would you be willing to share some feedback please?

@@ -36,6 +38,29 @@ import (
"github.com/caddyserver/caddy/v2/modules/caddyhttp/encode"
)

type VirtualFile struct {
Copy link
Member

Choose a reason for hiding this comment

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

The struct isn't used outside of the module boundaries, you can use virtualFile so we avoid exposing internals unnecessarily.

Copy link
Author

Choose a reason for hiding this comment

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

You are right, thanks!

I'll take care of it as soon as we agree on the direction of this PR.

@mholt
Copy link
Member
mholt commented May 6, 2024

Thanks for working on this -- I'll try to get around to this after the 2.8 release :)

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.

Support "precompressed" files without "base" files
4 participants