-
Notifications
You must be signed in to change notification settings - Fork 70
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
make it possible to disable cookies and optimize startup #578
base: main
Are you sure you want to change the base?
Conversation
|
||
```toml | ||
[dependencies] | ||
goose = { version = "^0.17", default-features = false, features = ["reqwest/default-tls"] } |
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.
When copying the example for testing the branch, I got this error below. Perhaps there should be additional cargo features that only enable default-tls
/rustls-tls
without including cookies
?
error: failed to parse manifest at `Cargo.toml`
Caused by:
feature `reqwest/default-tls` in dependency `goose` is not allowed to contain slashes
If you want to enable features of a transitive dependency, the direct dependency needs to re-export those features from the `[features]` table.
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.
I personally find the many cfg things to add a lot of complexity.
I am okay with some very restricted changes, but this PR feels overkill to me.
As far as I understand the slowdown is mostly from reqwest cookie feature itself, so removing that is fine, but cluttering the code with cfg feels like premature optimization.
Yes, the added config option is not an attempt to speed up or optimize anything. It's so the compiler can catch if someone 1) disables cookies, and then 2) tries to use cookie functinality: it will fail to compile. Without the config option, a person could disable cookies but use the code causing a panic or other undefined errors. |
cookies
feature, enabled by defaultcookies
are disabledcookies
feature is enabled in GooseBy making this a compile-time feature, we can enforce at compile-time that nobody expects cookies to work properly when using this startup optimization. Attempts to use Reqwest's cookie-related functions will fail if the Goose
cookie
feature is disabled. This also removes the cookie dependencies when it's not needed.