From: simon Date: Fri, 7 Jan 2005 14:22:17 +0000 (+0000) Subject: Proxy command formatting now recognises `%proxyhost' and X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/c4190b30d5c70af4aa1d3b57514047ea425bbcc4 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. git-svn-id: svn://svn.tartarus.org/sgt/putty@5073 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/proxy.c b/proxy.c index f21c17b5..5baab7a8 100644 --- a/proxy.c +++ b/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