mirror of
https://github.com/proxytunnel/proxytunnel.git
synced 2026-01-23 02:34:59 +00:00
Honor -o/--host on determining the SNI host name
This commit is contained in:
parent
470ac87f73
commit
097a0a2453
1 changed files with 9 additions and 5 deletions
14
ptstream.c
14
ptstream.c
|
|
@ -326,11 +326,15 @@ int stream_enable_ssl(PTSTREAM *pts, const char *proxy_arg) {
|
|||
SSL_set_wfd (ssl, stream_get_outgoing_fd(pts));
|
||||
|
||||
/* Determine the host name we are connecting to */
|
||||
proxy_arg_len = strlen(proxy_arg);
|
||||
peer_host = alloca(proxy_arg_len + 1);
|
||||
snprintf( proxy_arg_fmt, sizeof(proxy_arg_fmt), proxy_arg[0] == '[' ? "[%%%zu[^]]]" : "%%%zu[^:]", proxy_arg_len - 1 );
|
||||
if ( sscanf( proxy_arg, proxy_arg_fmt, peer_host ) != 1 ) {
|
||||
goto fail;
|
||||
if (args_info.host_given )
|
||||
peer_host = args_info.host_arg;
|
||||
else {
|
||||
proxy_arg_len = strlen(proxy_arg);
|
||||
peer_host = alloca(proxy_arg_len + 1);
|
||||
snprintf( proxy_arg_fmt, sizeof(proxy_arg_fmt), proxy_arg[0] == '[' ? "[%%%zu[^]]]" : "%%%zu[^:]", proxy_arg_len - 1 );
|
||||
if ( sscanf( proxy_arg, proxy_arg_fmt, peer_host ) != 1 ) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* SNI support */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue