-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fix build error when using specific or no Cargo compression features #339
Fix build error when using specific or no Cargo compression features #339
Conversation
also, if only one compression feature is enabled (e.g. compression-gzip) then the preferred encoding gets re-evaluated and assigned to that compression feature but only if it is part of the `accept-encoding` header value. now the following scenarios will work: [dependencies] static-web-server = { version = "2.28.0", default-features = false } or [dependencies] static-web-server = { version = "2.28.0", default-features = false, features = ["compression-brotli"] } in addition, some tracing logs are added to reflect the changes.
Review changes with SemanticDiff. Analyzed 12 of 12 files. Overall, the semantic diff is 42% smaller than the GitHub diff.
|
feature = "compression", | ||
feature = "compression-deflate", | ||
feature = "compression-gzip", | ||
feature = "compression-deflate", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: you are checking for compression-deflate
twice here and a bunch of other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one, yeah it has to be removed.
@@ -8,13 +8,13 @@ | |||
|
|||
// Part of the file is borrowed from <https://github.com/seanmonstar/warp/pull/513>* | |||
|
|||
#[cfg(feature = "compression-brotli")] | |||
#[cfg(any(feature = "compression", feature = "compression-brotli"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: With the compression
feature activating the compression-brotli
feature, I’m fairly certain that this change (and a bunch of similar ones) is unnecessary. Unless you are doing this for readability purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, I'm doing this just for readability because using compression
already implies the other ones.
But it could be removed without a problem.
Feel free to clean this up if you think so.
Description
This PR fixes a build issue when SWS is used as a dependency and the Cargo
compression
feature is disabled completely or just some specific compression features are enabled.Also, if only one compression feature is enabled (e.g.
compression-gzip
) then the preferred encoding gets re-evaluated and assigned to that compression feature format (e.g.gzip
) but only if it was part of theaccept-encoding
request header value.For example, now the following scenarios will work:
In addition, some logs are added/improved to reflect the changes.
Related Issue
Fixes #338
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):