-Xftp flag for http proxy
Some checks failed
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
C/C++ CI cmake / ubuntu-latest (wolfSSL) (push) Has been cancelled

This commit is contained in:
Vladimir Dubrovin 2026-08-29 23:53:59 +03:00
parent f2ae920db2
commit 5af6147a41
5 changed files with 22 additions and 1 deletions

View File

@ -244,6 +244,12 @@ Never ask for username/password
.br .br
.B -a2 .B -a2
(for proxy) generate Via: and X-Forwarded-For: instead of Forwarded: (for proxy) generate Via: and X-Forwarded-For: instead of Forwarded:
.br
.B -Xftp
(for proxy) fetch \fBftp://\fR URLs, in a build with FTP support. Without
this the scheme is not one the service knows, whatever the build: fetching it
opens a second connection and builds a listing, which a service serving http
has no use for.
.br .br
Also, all options mentioned for Also, all options mentioned for
.BR proxy (8) .BR proxy (8)
@ -1580,7 +1586,8 @@ authentication and/or allow/deny ACLs.
The mail proxies and FTP are built when they are asked for, and are not in a The mail proxies and FTP are built when they are asked for, and are not in a
default build. \fBMAILPROXY=true\fR builds \fBpop3p\fR, \fBimapp\fR and default build. \fBMAILPROXY=true\fR builds \fBpop3p\fR, \fBimapp\fR and
\fBsmtpp\fR, and \fBFTP=true\fR builds \fBftppr\fR and the \fBftp://\fR \fBsmtpp\fR, and \fBFTP=true\fR builds \fBftppr\fR and the \fBftp://\fR
scheme of the HTTP proxy; with CMake the switches are scheme of the HTTP proxy, which a \fBproxy\fR service then still has to ask
for with \fB-Xftp\fR; with CMake the switches are
\fB-D3PROXY_USE_MAILPROXY=ON\fR and \fB-D3PROXY_USE_FTP=ON\fR. The standalone \fB-D3PROXY_USE_MAILPROXY=ON\fR and \fB-D3PROXY_USE_FTP=ON\fR. The standalone
binaries of those services are built with them and not without. binaries of those services are built with them and not without.
.br .br

View File

@ -187,6 +187,9 @@ static int h_proxy(int argc, unsigned char ** argv){
childdef.port = 3128; childdef.port = 3128;
childdef.isudp = 0; childdef.isudp = 0;
childdef.service = S_PROXY; childdef.service = S_PROXY;
#ifdef WITH_FTP
childdef.helpmessage = " -Xftp - fetch ftp:// URLs\n";
#endif
#ifdef NOIPV6 #ifdef NOIPV6
if(!resolvfunc || (resolvfunc == myresolver && !dns_table.poolsize)){ if(!resolvfunc || (resolvfunc == myresolver && !dns_table.poolsize)){
fprintf(stderr, "[line %d] Warning: no nserver/nscache configured, proxy may run very slow\n", linenum); fprintf(stderr, "[line %d] Warning: no nserver/nscache configured, proxy may run very slow\n", linenum);

View File

@ -387,6 +387,7 @@ for(;;){
} }
#ifdef WITH_FTP #ifdef WITH_FTP
else if (!strncasecmp((char *)sb, "ftp://", 6)) { else if (!strncasecmp((char *)sb, "ftp://", 6)) {
if(!param->srv->allowftp) RETURN(513);
ftp = 1; ftp = 1;
sb += 6; sb += 6;
} }
@ -1357,6 +1358,9 @@ struct proxydef childdef = {
S_PROXY, S_PROXY,
"-a - anonymous proxy\r\n" "-a - anonymous proxy\r\n"
"-a1 - anonymous proxy with random client IP spoofing\r\n" "-a1 - anonymous proxy with random client IP spoofing\r\n"
#ifdef WITH_FTP
"-Xftp - fetch ftp:// URLs\r\n"
#endif
}; };
#include "proxymain.c" #include "proxymain.c"
#endif #endif

View File

@ -584,6 +584,12 @@ int MODULEMAINFUNC (int argc, char** argv){
if(!strncasecmp(argv[i]+2, "imap", 4)) srv.srvstarttls = S_IMAPP; if(!strncasecmp(argv[i]+2, "imap", 4)) srv.srvstarttls = S_IMAPP;
else if(!strncasecmp(argv[i]+2, "pop3", 4)) srv.srvstarttls = S_POP3P; else if(!strncasecmp(argv[i]+2, "pop3", 4)) srv.srvstarttls = S_POP3P;
else if(!strncasecmp(argv[i]+2, "smtp", 4)) srv.srvstarttls = S_SMTPP; else if(!strncasecmp(argv[i]+2, "smtp", 4)) srv.srvstarttls = S_SMTPP;
#ifdef WITH_FTP
/* The http proxy fetches ftp:// only where it was asked to:
the protocol brings a second connection and a listing to
build, which a service serving http has no use for. */
else if(!strncasecmp(argv[i]+2, "ftp", 3)) srv.allowftp = 1;
#endif
else error = 1; else error = 1;
break; break;
case 'F': case 'F':

View File

@ -611,6 +611,7 @@ struct srvparam {
int haproxy; int haproxy;
int nostarttls; int nostarttls;
PROXYSERVICE srvstarttls; PROXYSERVICE srvstarttls;
int allowftp; /* the http proxy fetches ftp:// for this service */
uint32_t fakeip; uint32_t fakeip;
unsigned char fakeip6[16]; unsigned char fakeip6[16];
#ifdef WITHSPLICE #ifdef WITHSPLICE