lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lynx-dev] Adding $SOCKS5_PROXY support, changing command line optio


From: Steffen Nurpmeso
Subject: Re: [Lynx-dev] Adding $SOCKS5_PROXY support, changing command line option
Date: Fri, 07 Aug 2020 23:40:11 +0200
User-agent: s-nail v14.9.19-100-gd425f9da-dirty

Hello.

In April i sent a message saying

Steffen Nurpmeso wrote in
 <20200421152638.pl92s%steffen@sdaoden.eu>:
 |Please find attached an extension to the -socks5-proxy patch that
 |made it in.  On FreeBSD, they have started adding support for
 |a $SOCKS5_PROXY environment variable, see for example commit
 |[bf579e30a4d54a2d7203cdb1d1689dde46db5db6]:
 |
 |  ...
 |  This change adds SOCKS5 support to the library fetch(3) and
 |  updates the man page.
 |
 |  Details: Within the fetch_connect() function, fetch(3) checks if
 |  the SOCKS5_PROXY environment variable is set. If so, it connects
 |  to this host rather than the end-host. It then initializes the
 |  SOCKS5 connection in
 |  ...
 |
 |I felt it would be nice to integrate within this automatic proxy
 |selection and added support for the MUA i maintain (in as of
 |v14.9.18), and here is the same for lynx.
 |
 |I also changed the option name -socks5-proxy to -socks5_proxy,
 |i apologise for creating an option name that stands out from all
 |other options at first.  Sorry.
 |
 |Better documentation comes as part of this, too.
 |
 |Ciao and good luck everybody from Germany,
 ...

Is there any interest in that?

 |diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementa\
 |tion/HTTCP.c
 |index 2834c2c7..e3ef663e 100644
 |--- a/WWW/Library/Implementation/HTTCP.c
 |+++ b/WWW/Library/Implementation/HTTCP.c
 |@@ -1847,8 +1847,13 @@ int HTDoConnect(const char *url,
 | 
 |     *s = -1;                 /* nothing is open yet */
 | 
 |-    /* In case of a present SOCKS5 proxy, marshal */
 |-    if ((socks5_orig_url = socks5_proxy) != NULL) {
 |+    /* In case of a present SOCKS5 proxy, marshal.
 |+     * Perform a getenv(3) lookup only once */
 |+    if (socks5_proxy == NULL &&
 |+         (socks5_proxy = getenv("SOCKS5_PROXY")) == NULL)
 |+     socks5_proxy = (char*)-1;
 |+
 |+    if (socks5_proxy != (char*)-1) {
 |  int xport;
 | 
 |  xport = default_port;
 |@@ -2393,7 +2398,7 @@ int HTDoConnect(const char *url,
 |}
 | 
 |   cleanup:
 |-    if (socks5_proxy != NULL) {
 |+    if (socks5_proxy != (char*)-1) {
 |  FREE(socks5_new_url);
 |  FREE(socks5_protocol);
 |  FREE(socks5_host);
 |diff --git a/lynx.man b/lynx.man
 |index e1900a28..5b6e011c 100644
 |--- a/lynx.man
 |+++ b/lynx.man
 |@@ -805,9 +805,16 @@ If enabled the transfer rate is shown in bytes/second.
 | If disabled, no transfer rate is shown.
 | Use lynx.cfg or the options menu to select KB/second and/or ETA.
 | .TP
 |-.B \-socks5-proxy=URL
 |-(Via which) SOCKS5 proxy to connect.
 |-This controls the builtin SOCKS5 support, and is therefore unrelated to
 |+.B \-socks5_proxy=URL
 |+(Via which) SOCKS5 proxy to connect: any network traffic, including all
 |+DNS resolutions but the one for URL itself, will be redirected through
 |+the SOCKS5 proxy.
 |+URL may be given as \*(``proxy.example.com\*('',
 |+\*(``proxy.example.com:1080\*('', \*(``192.168.0.1\*('', or
 |+\*(``192.168.0.1:1080\*('' (and IPv6 notation if so supported).
 |+A SOCKS5 proxy may also be specified via the environment variable
 |+.B SOCKS5_PROXY .
 |+This option controls the builtin SOCKS5 support, which is unrelated to
 | the option \fB\-nosocks\fP.
 | .TP
 | .B \-soft_dquotes
 |@@ -1139,6 +1146,11 @@ wais_proxy
 | .IP
 | See \fBLynx Users Guide\fR for additional details and examples.
 | .TP
 |+.B SOCKS5_PROXY
 |+Is inspected if
 |+.B \-socks5_proxy
 |+has not been used (for the same content).
 |+.TP
 | .B SSL_CERT_DIR
 | Set to the directory containing trusted certificates.
 | .TP
 |diff --git a/src/LYMain.c b/src/LYMain.c
 |index 6d5166d4..45fc3ce2 100644
 |--- a/src/LYMain.c
 |+++ b/src/LYMain.c
 |@@ -3916,7 +3916,7 @@ saves session to that file on exit"
 |    ),
 | #endif
 |    PARSE_STR(
 |-      "socks5-proxy",        2|NEED_LYSTRING_ARG,    socks5_proxy,
 |+      "socks5_proxy",        2|NEED_LYSTRING_ARG,    socks5_proxy,
 |       "=URL\n(via which) SOCKS5 proxy to connect (unrelated to -nosocks!)"
 |    ),
 |    PARSE_SET(

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]