git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to get git-send-email use a proxy?
@ 2022-04-06 14:19 Shaoxuan Yuan
  2022-04-07 21:52 ` brian m. carlson
  0 siblings, 1 reply; 5+ messages in thread
From: Shaoxuan Yuan @ 2022-04-06 14:19 UTC (permalink / raw)
  To: Git List

Greetings, Git community,

I'm using git-send-email with Git 2.35.1 under system
5.4.72-microsoft-standard-WSL2, x86_64 GNU/Linux.

I am on a system-wide socks5 proxy. Although I set the global
.gitconfig to use the socks5 proxy trying to send emails, the
connection to the SMTP server seems does not go through the proxy at
all.

Other git commands do go through the globally set .gitconfig proxy,
git-send-email seems to be an exception.

So I'm wondering if there needs to be a code change in
'git-send-email.perl' to run the connection through a proxy, or I just
need to tune the setting to accomplish this?

-- 
Thanks & Regards,
Shaoxuan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to get git-send-email use a proxy?
  2022-04-06 14:19 How to get git-send-email use a proxy? Shaoxuan Yuan
@ 2022-04-07 21:52 ` brian m. carlson
  2022-04-08  9:01   ` Shaoxuan Yuan
  0 siblings, 1 reply; 5+ messages in thread
From: brian m. carlson @ 2022-04-07 21:52 UTC (permalink / raw)
  To: Shaoxuan Yuan; +Cc: Git List

[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]

On 2022-04-06 at 14:19:43, Shaoxuan Yuan wrote:
> Greetings, Git community,
> 
> I'm using git-send-email with Git 2.35.1 under system
> 5.4.72-microsoft-standard-WSL2, x86_64 GNU/Linux.
> 
> I am on a system-wide socks5 proxy. Although I set the global
> .gitconfig to use the socks5 proxy trying to send emails, the
> connection to the SMTP server seems does not go through the proxy at
> all.
> 
> Other git commands do go through the globally set .gitconfig proxy,
> git-send-email seems to be an exception.

I think you're referring to http.proxy.  That affects only HTTP, HTTPS,
and FTP (if we even still support that).  All of those protocols are
handled by libcurl, which includes native proxy support.  It doesn't
affect other protocols like SSH or SMTP.

> So I'm wondering if there needs to be a code change in
> 'git-send-email.perl' to run the connection through a proxy, or I just
> need to tune the setting to accomplish this?

git send-email is written in Perl and doesn't use libcurl, so it doesn't
have proxy support.  If there's a particular optional module we could
dynamically load to provide proxy support, that's an option we could
support if someone wanted to provide a patch.

In the mean time, you could also try using some sort of tool, like
socat, to bind a local port tunnelling over the proxy to the destination
server and then use SMTP over that local port to connect.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to get git-send-email use a proxy?
  2022-04-07 21:52 ` brian m. carlson
@ 2022-04-08  9:01   ` Shaoxuan Yuan
  2022-04-08 11:51     ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 5+ messages in thread
From: Shaoxuan Yuan @ 2022-04-08  9:01 UTC (permalink / raw)
  To: brian m. carlson, Shaoxuan Yuan, Git List

On Fri, Apr 8, 2022 at 5:53 AM brian m. carlson
<sandals@crustytoothpaste.net> wrote:
>
> On 2022-04-06 at 14:19:43, Shaoxuan Yuan wrote:
> > Greetings, Git community,
> >
> > I'm using git-send-email with Git 2.35.1 under system
> > 5.4.72-microsoft-standard-WSL2, x86_64 GNU/Linux.
> >
> > I am on a system-wide socks5 proxy. Although I set the global
> > .gitconfig to use the socks5 proxy trying to send emails, the
> > connection to the SMTP server seems does not go through the proxy at
> > all.
> >
> > Other git commands do go through the globally set .gitconfig proxy,
> > git-send-email seems to be an exception.
>
> I think you're referring to http.proxy.  That affects only HTTP, HTTPS,
> and FTP (if we even still support that).  All of those protocols are
> handled by libcurl, which includes native proxy support.  It doesn't
> affect other protocols like SSH or SMTP.
>
> > So I'm wondering if there needs to be a code change in
> > 'git-send-email.perl' to run the connection through a proxy, or I just
> > need to tune the setting to accomplish this?
>
> git send-email is written in Perl and doesn't use libcurl, so it doesn't
> have proxy support.  If there's a particular optional module we could
> dynamically load to provide proxy support, that's an option we could
> support if someone wanted to provide a patch.
>
> In the mean time, you could also try using some sort of tool, like
> socat, to bind a local port tunnelling over the proxy to the destination
> server and then use SMTP over that local port to connect.
> --
> brian m. carlson (he/him or they/them)
> Toronto, Ontario, CA

Thanks, it's pretty informative ;-)

-- 
Thanks & Regards,
Shaoxuan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to get git-send-email use a proxy?
  2022-04-08  9:01   ` Shaoxuan Yuan
@ 2022-04-08 11:51     ` Ævar Arnfjörð Bjarmason
  2022-04-08 12:03       ` Shaoxuan Yuan
  0 siblings, 1 reply; 5+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2022-04-08 11:51 UTC (permalink / raw)
  To: Shaoxuan Yuan; +Cc: brian m. carlson, Git List


On Fri, Apr 08 2022, Shaoxuan Yuan wrote:

> On Fri, Apr 8, 2022 at 5:53 AM brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
>>
>> On 2022-04-06 at 14:19:43, Shaoxuan Yuan wrote:
>> > Greetings, Git community,
>> >
>> > I'm using git-send-email with Git 2.35.1 under system
>> > 5.4.72-microsoft-standard-WSL2, x86_64 GNU/Linux.
>> >
>> > I am on a system-wide socks5 proxy. Although I set the global
>> > .gitconfig to use the socks5 proxy trying to send emails, the
>> > connection to the SMTP server seems does not go through the proxy at
>> > all.
>> >
>> > Other git commands do go through the globally set .gitconfig proxy,
>> > git-send-email seems to be an exception.
>>
>> I think you're referring to http.proxy.  That affects only HTTP, HTTPS,
>> and FTP (if we even still support that).  All of those protocols are
>> handled by libcurl, which includes native proxy support.  It doesn't
>> affect other protocols like SSH or SMTP.
>>
>> > So I'm wondering if there needs to be a code change in
>> > 'git-send-email.perl' to run the connection through a proxy, or I just
>> > need to tune the setting to accomplish this?
>>
>> git send-email is written in Perl and doesn't use libcurl, so it doesn't
>> have proxy support.  If there's a particular optional module we could
>> dynamically load to provide proxy support, that's an option we could
>> support if someone wanted to provide a patch.
>>
>> In the mean time, you could also try using some sort of tool, like
>> socat, to bind a local port tunnelling over the proxy to the destination
>> server and then use SMTP over that local port to connect.
>> --
>> brian m. carlson (he/him or they/them)
>> Toronto, Ontario, CA
>
> Thanks, it's pretty informative ;-)

If you want to add a "native" feature to git-send-email.perl (and
provide a patch) it looks from
https://stackoverflow.com/questions/3253360/using-socks5-proxy-with-netsmtp
that doing so isn't too hard.

I.e. Net::SMTP (which we use) just uses standard Perl modules to connect
to the network, and there's other existing modules to ferry any such
connection through a SOCKS proxy: https://metacpan.org/pod/Net::SOCKS &
https://metacpan.org/pod/IO::Socket::Socks (I'm not sure which of these
is a better choice).

So it seems like a rather easy 10-20 line patch (including docs and
boilerplate) where we'd just create our own Git::Net::SMTP class, and
that class in turn would be like Net::SMTP, except its @ISA would first
dispatch to a "new" in a class we own.

We could thus intercept the new() invocation it makes to the socket
class it's picking now, and direct it to a wrapper.

There's probably even an existing CPAN module for "given this class,
screw with its @ISA such that socks support is added", I just haven't
looked.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to get git-send-email use a proxy?
  2022-04-08 11:51     ` Ævar Arnfjörð Bjarmason
@ 2022-04-08 12:03       ` Shaoxuan Yuan
  0 siblings, 0 replies; 5+ messages in thread
From: Shaoxuan Yuan @ 2022-04-08 12:03 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: brian m. carlson, Git List

On Fri, Apr 8, 2022 at 8:01 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
>
>
> On Fri, Apr 08 2022, Shaoxuan Yuan wrote:
>
> > On Fri, Apr 8, 2022 at 5:53 AM brian m. carlson
> > <sandals@crustytoothpaste.net> wrote:
> >>
> >> On 2022-04-06 at 14:19:43, Shaoxuan Yuan wrote:
> >> > Greetings, Git community,
> >> >
> >> > I'm using git-send-email with Git 2.35.1 under system
> >> > 5.4.72-microsoft-standard-WSL2, x86_64 GNU/Linux.
> >> >
> >> > I am on a system-wide socks5 proxy. Although I set the global
> >> > .gitconfig to use the socks5 proxy trying to send emails, the
> >> > connection to the SMTP server seems does not go through the proxy at
> >> > all.
> >> >
> >> > Other git commands do go through the globally set .gitconfig proxy,
> >> > git-send-email seems to be an exception.
> >>
> >> I think you're referring to http.proxy.  That affects only HTTP, HTTPS,
> >> and FTP (if we even still support that).  All of those protocols are
> >> handled by libcurl, which includes native proxy support.  It doesn't
> >> affect other protocols like SSH or SMTP.
> >>
> >> > So I'm wondering if there needs to be a code change in
> >> > 'git-send-email.perl' to run the connection through a proxy, or I just
> >> > need to tune the setting to accomplish this?
> >>
> >> git send-email is written in Perl and doesn't use libcurl, so it doesn't
> >> have proxy support.  If there's a particular optional module we could
> >> dynamically load to provide proxy support, that's an option we could
> >> support if someone wanted to provide a patch.
> >>
> >> In the mean time, you could also try using some sort of tool, like
> >> socat, to bind a local port tunnelling over the proxy to the destination
> >> server and then use SMTP over that local port to connect.
> >> --
> >> brian m. carlson (he/him or they/them)
> >> Toronto, Ontario, CA
> >
> > Thanks, it's pretty informative ;-)
>
> If you want to add a "native" feature to git-send-email.perl (and
> provide a patch) it looks from
> https://stackoverflow.com/questions/3253360/using-socks5-proxy-with-netsmtp
> that doing so isn't too hard.
>
> I.e. Net::SMTP (which we use) just uses standard Perl modules to connect
> to the network, and there's other existing modules to ferry any such
> connection through a SOCKS proxy: https://metacpan.org/pod/Net::SOCKS &
> https://metacpan.org/pod/IO::Socket::Socks (I'm not sure which of these
> is a better choice).
>
> So it seems like a rather easy 10-20 line patch (including docs and
> boilerplate) where we'd just create our own Git::Net::SMTP class, and
> that class in turn would be like Net::SMTP, except its @ISA would first
> dispatch to a "new" in a class we own.
>
> We could thus intercept the new() invocation it makes to the socket
> class it's picking now, and direct it to a wrapper.
>
> There's probably even an existing CPAN module for "given this class,
> screw with its @ISA such that socks support is added", I just haven't
> looked.

Thanks for the info, I will definitely try to make a patch and see how it
works :-)

-- 
Thanks & Regards,
Shaoxuan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-08 12:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 14:19 How to get git-send-email use a proxy? Shaoxuan Yuan
2022-04-07 21:52 ` brian m. carlson
2022-04-08  9:01   ` Shaoxuan Yuan
2022-04-08 11:51     ` Ævar Arnfjörð Bjarmason
2022-04-08 12:03       ` Shaoxuan Yuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).