Skip to content

Enable socks5 proxy support#474

Merged
hoytak merged 2 commits intohuggingface:mainfrom
SuperKenVery:feat/superkenvery/socks5-proxy
Sep 26, 2025
Merged

Enable socks5 proxy support#474
hoytak merged 2 commits intohuggingface:mainfrom
SuperKenVery:feat/superkenvery/socks5-proxy

Conversation

@SuperKenVery
Copy link
Contributor

@SuperKenVery SuperKenVery commented Aug 26, 2025

  • Tested on my machine. It does use socks5 proxy specified in all_proxy env var.

@rajatarya
Copy link
Collaborator

Hi @SuperKenVery : Can you describe the use case for adding socks5 proxy support? Can you add some tests for this use case in this PR as well?

@seanses
Copy link
Collaborator

seanses commented Aug 26, 2025

@rajatarya AFAIK some VPN services use SOCKS5 tunnel.

@assafvayner
Copy link
Contributor

So I see enabling this feature adds proxy support, but we will need to add some docs on how to use proxy by environment variable. (we don't need to setup our own special way to handle proxies then, at least not yet)

https://github.com/seanmonstar/reqwest/blob/v0.12.23/src/lib.rs#L137-L158

@SuperKenVery
Copy link
Contributor Author

I should definitely add some tests to this, as well as adding some docs.

The reason for socks5 support is that, my school server doesn't have an internet access. And socks5 is more convenient than http(s) proxy in that I could use ssh -R 1080 host to setup a socks proxy server.

@SuperKenVery SuperKenVery marked this pull request as draft August 27, 2025 08:12
@hoytak
Copy link
Collaborator

hoytak commented Sep 15, 2025

@rajatarya @assafvayner: Looking at this PR, this seems like a low risk change and we should just get it in. Note that it is simply enabling a feature flag in the reqwests crate.

To address the concerns:

  • Proxy support is enabled through standard environment variables that are well documented and independent of any specific program, so we don't need to document them ourselves. See the docs on HTTP_PROXY or HTTPS_PROXY.
  • Tests would already be present in the reqwest layer, so I don't think we need to add specific tests for this.

@hoytak
Copy link
Collaborator

hoytak commented Sep 15, 2025

@SuperKenVery -- just verifying here. When you enabled that feature flag in reqwest, were you able to get the connection to work in your environment?

@SuperKenVery
Copy link
Contributor Author

SuperKenVery commented Sep 16, 2025

Yes, it's able to use socks5 proxy in my environment.

Given that you've address the concerns, I'm converting this from draft to pr...

@SuperKenVery SuperKenVery marked this pull request as ready for review September 16, 2025 03:44
@hoytak
Copy link
Collaborator

hoytak commented Sep 16, 2025

Yes, it's able to use socks5 proxy in my environment.

Given that you've address the concerns, I'm converting this from draft to pr...

Thank you. Before we merge it, could you edit the description of the PR to include this information and how you tested it. Also, I think we need to check in the Cargo.lock that have changed as well. If you could do the following and then check in the changed lock files, that would be great:

  • Run cargo build in the main directory.
  • In hf_xet/, run maturin develop.
  • In hf_xet_wasm, run ./build_wasm.sh

@SuperKenVery
Copy link
Contributor Author

SuperKenVery commented Sep 17, 2025

Okay I'll run those commands and edit PR description. I previously tested by doing an editable install in pip.


EDIT: I checked Cargo.lock, it seems it's indeed unchanged. This is further verified by this: https://asciinema.org/a/2QPqTXaBvliqsKHAVkns64nPD


EDIT2: I ran the commands you mentioned, and they ran without problems. 🥂

@hoytak hoytak self-requested a review September 25, 2025 19:52
Copy link
Collaborator

@hoytak hoytak 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!

@hoytak hoytak merged commit 94fa944 into huggingface:main Sep 26, 2025
6 checks passed
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.

5 participants