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

fileserver: Fix compression breaks using httpInclude (#4352) #4358

Merged
merged 3 commits into from
Oct 16, 2021

Conversation

u5surf
Copy link
Contributor

@u5surf u5surf commented Sep 21, 2021

Fixes: #4352

  • Add Accept-Encoding: identity in virtReq

  • Add Unit tests for funcHTTPInclude

  • Change variable name context to tplContext to use context package

But I don't know my test implementation is really enough to this fix.
We should make a generic tests or e2e tests about templates to check how does it compression or not.
I'm not sure how and what to add these tests.

@francislavoie francislavoie added the under review 🧐 Review is pending before merging label Sep 21, 2021
@francislavoie francislavoie added this to the v2.4.6 milestone Sep 21, 2021
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, I like where this is going. I'm not 100% sure on the right function to use here. Is there a specific reason you went with Add instead of Set?

modules/caddyhttp/templates/tplcontext.go Outdated Show resolved Hide resolved
@u5surf u5surf force-pushed the issue-4352 branch 2 times, most recently from d031748 to f3eaa62 Compare October 1, 2021 01:37
@mholt mholt changed the title fileserver: Fix compression breaks using httpInclude(#4352) fileserver: Fix compression breaks using httpInclude (#4352) Oct 1, 2021
mholt
mholt previously requested changes Oct 1, 2021
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.

Looks like the change doesn't compile yet, that will need to be fixed (the context collision) - see the CI logs for details.

Otherwise, this LGTM.

Does your test fail without the change?

modules/caddyhttp/templates/tplcontext.go Outdated Show resolved Hide resolved
* Add `Accept-Encoding: identity` in virtReq

* Add Unit tests for funcHTTPInclude

* Change variable name `context` to `tplContext` to use `context` package
@u5surf
Copy link
Contributor Author

u5surf commented Oct 1, 2021

@mholt

Does your test fail without the change?

It seemed to doubt whether test failed without my changes. But just now, I came up with how to check overwriting Accept-Encoding header with this test.

Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks!

@francislavoie francislavoie dismissed mholt’s stale review October 16, 2021 15:08

Comments have been addressed

@francislavoie francislavoie merged commit 64f8b55 into caddyserver:master Oct 16, 2021
@mholt mholt removed the under review 🧐 Review is pending before merging label Oct 18, 2021
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.

Compression breaks file_server browse template using httpInclude
3 participants