mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Proxy command formatting now recognises `%proxyhost' and
`%proxyport' in addition to the other things it interpolates. This is useful when using the Unix-only `Local' proxy type: it allows me to, for example, set up a proxy command such as ssh %proxyhost nc -q0 %host %port and then enter the name of the proxy machine in `Proxy hostname', which makes it marginally more convenient to quickly change to using a different proxy to get at the same target. I haven't documented this, because we currently don't document the Local proxy type at all. Possibly we should, though. [originally from svn r5073]
This commit is contained in:
parent
88c52fa85f
commit
eb0583762c
22
proxy.c
22
proxy.c
@ -1315,7 +1315,8 @@ char *format_telnet_command(SockAddr addr, int port, const Config *cfg)
|
||||
} else {
|
||||
|
||||
/* % escape. we recognize %%, %host, %port, %user, %pass.
|
||||
* anything else, we just send unescaped (including the %).
|
||||
* %proxyhost, %proxyport. Anything else we just send
|
||||
* unescaped (including the %).
|
||||
*/
|
||||
|
||||
if (cfg->proxy_telnet_command[eo] == '%') {
|
||||
@ -1359,6 +1360,25 @@ char *format_telnet_command(SockAddr addr, int port, const Config *cfg)
|
||||
retlen += passlen;
|
||||
eo += 4;
|
||||
}
|
||||
else if (strnicmp(cfg->proxy_telnet_command + eo,
|
||||
"proxyhost", 4) == 0) {
|
||||
int phlen = strlen(cfg->proxy_host);
|
||||
ENSURE(phlen);
|
||||
memcpy(ret+retlen, cfg->proxy_host, phlen);
|
||||
retlen += phlen;
|
||||
eo += 9;
|
||||
}
|
||||
else if (strnicmp(cfg->proxy_telnet_command + eo,
|
||||
"proxyport", 4) == 0) {
|
||||
char pport[50];
|
||||
int pplen;
|
||||
sprintf(pport, "%d", cfg->proxy_port);
|
||||
pplen = strlen(cfg->proxy_host);
|
||||
ENSURE(pplen);
|
||||
memcpy(ret+retlen, pport, pplen);
|
||||
retlen += pplen;
|
||||
eo += 9;
|
||||
}
|
||||
else {
|
||||
/* we don't escape this, so send the % now, and
|
||||
* don't advance eo, so that we'll consider the
|
||||
|
Loading…
Reference in New Issue
Block a user