Skip to content

feat(native-connect-hook): enhance support for system connection hooks #146

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

Merged
merged 1 commit into from
Jul 3, 2025

Conversation

acomerlatto
Copy link
Contributor

@acomerlatto acomerlatto commented Jul 3, 2025

Description:
This PR improves the robustness and readability of the native connection hook implementation.

  • Declares the system module as a constant.
  • Introduces a variable to store the address of the connect function, simplifying the interceptor setup. conn
  • Wraps native function lookups in a try...catch block to ensure graceful failure and clearer error messaging if system functions cannot be resolved.

-- Text Generated with AI --

- Declare system module as a constant.
- Add `conn` variable for cleaner `Interceptor.attach` initialization.
- Improve error handling.
@pimterry pimterry merged commit a07671f into httptoolkit:main Jul 3, 2025
4 checks passed
@pimterry
Copy link
Member

pimterry commented Jul 3, 2025

Thanks @acomerlatto. I think it's very unlikely that this line will actually fail, but yes I agree this is a nice improvement anyway. Thanks! I have some automated tests here coming soon as well, which should help with avoiding issues like #145 in future hopefully.

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.

2 participants