rbenv / ruby-build

A tool to download, compile, and install Ruby on Unix-like systems.
https://rbenv.org/man/ruby-build.1
MIT License
3.89k stars 785 forks source link

[Feature Request] Enable SOCKS support by default #2431

Closed MatzFan closed 3 months ago

MatzFan commented 3 months ago

I'm the current maintainer of the socksify Ruby gem. This gem was originally created to permit users of rubies to make SOCKS connections via net/http and other libraries. The gem patches the private method Net::HTTP#connect which of course is highly undesirable, as it is subject to change with each new Ruby release. This is all necessary because pre-built rubies do not have socks support enabled by default.

Is there any reason why pre-built rubies cannot have this support enabled by default? I understand that one needs to pass the --enable-socks=true configuration option when compiling in order for the SOCKSSocket class to be enabled.

Why the need? Well many Rubyists use SOCKS for various reasons (e.g to interact through SOCKS proxies like dante or tor). The socksify gem has 57M downloads for the current version. Many other languages offer native support for the SOCKS protocol and if there is no downside I'd love to see the pre-built rubies used by the Ruby community do the same - say from version 3.4 onwards - so socksify can be gracefully retired. \end pitch

mislav commented 3 months ago

Hi, the aim of this project is to be a lightweight wrapper around downloading a Ruby source code tarball, running ./configure, running make, and finally make install. We try to not deviate from defaults in this process, including setting configuration flags, unless there is a strong reason to do so.

(Note that we do not provide "pre-built" rubies, but compile a Ruby version every time ruby-build gets invoked.)

The only non-default configure flag we currently set is --enable-shared https://github.com/rbenv/ruby-build/issues/35. This is to help install some gems that need ruby to have a shared library. This was requested by multiple people after some frustration.

However, I haven't heard of --enable-socks being a highly used or even requested feature. I'm not sure why this Ruby core feature is off by default, but I do not find sufficient evidence that this is a flag that we should turn on by default in ruby-build. That is why I'm deciding that this is a #wontfix. Thank you for explaining your perspective, though. We can refer to this thread if the issue of SOCKS comes up again.

Note that ruby-build users can opt into having SOCKS enabled in their ruby by doing ruby-build <version> /path/to/ruby -- --enable-socks=true explicitly.

MatzFan commented 3 months ago

Understood @mislav, quite understand your rationale.

I'm not sure why this Ruby core feature is off by default

Indeed. My next stop is an enhancement suggestion to Ruby-Talk. Thanks for your time.

MatzFan commented 3 months ago

@mislav FYI my request was accepted and Ruby master now enables the SOCKS flag by default. AFAIK CI build envs like ubuntu-latest don't have any socks libs installed, but at least users installing one of your builds who do will get Ruby's native SOCKS functionality in the future.