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

Fix: httpc set_options override #8878

Open
wants to merge 7 commits into
base: maint
Choose a base branch
from

Conversation

MarkoMin
Copy link
Contributor

@MarkoMin MarkoMin commented Oct 2, 2024

The bug was due to invalid validation of options that was acting like the user always passed ipfamily and unix_socket options, so each time when calling set_option(s) those options would get overridden by default values (if option values weren't present in the new options list).

Validation of ipfamily and unix_socket combination was not just buggy, but also insufficient because the httpc state could end up with invalid combination of those options which I proved in the httpc_SUITE:invalid_ipfamily_unix_socket/1 testcase (which fails on the current code). I also believe that there was a typo in httpc:validate_ipfamily_unix_socket/1 where ipfamily option got deleted twice, but unix_socket was not, so we could end up having two unix_socket entries after validation....

With the new behavior that checks current and new options httpc can't end up having invalid ipfamily-unix_socket combo. I also believe that new error is more informative to the user on what's going on and why validation failed.

I also removed deprecated ipv6 handling in httpc_manager because ipv6 gets translated to ipfamily option in httpc:validate_options/3 so there is no way that ipv6 entry can ever be passed to httpc_manager. httpc_manager:set_options is called only from httpc:set_options which validates (and translates) ipv6 option so this should be safe.

Closes #8829

Copy link
Contributor

github-actions bot commented Oct 2, 2024

CT Test Results

  2 files   22 suites   10m 39s ⏱️
350 tests 345 ✅  5 💤 0 ❌
620 runs  569 ✅ 51 💤 0 ❌

Results for commit 7f4340a.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@MarkoMin MarkoMin force-pushed the fix/httpc_setoptions_override branch from f3f1aad to 762fe61 Compare October 2, 2024 03:05
@Whaileee Whaileee self-assigned this Oct 2, 2024
@Whaileee Whaileee added the testing currently being tested, tag is used by OTP internal CI label Oct 2, 2024
@u3s u3s added the team:PO Assigned to OTP team PO label Oct 2, 2024
@Whaileee Whaileee removed the testing currently being tested, tag is used by OTP internal CI label Oct 3, 2024
@MarkoMin
Copy link
Contributor Author

MarkoMin commented Oct 3, 2024

maybe seems like a perfect fit here

@Whaileee Whaileee added testing currently being tested, tag is used by OTP internal CI and removed testing currently being tested, tag is used by OTP internal CI labels Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:PO Assigned to OTP team PO
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants