Change the name of servername when re-connect
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
This commit is contained in:
parent
be98f96de2
commit
fb8ac46add
1 changed files with 6 additions and 6 deletions
|
@ -366,7 +366,6 @@ int main( void )
|
|||
"\n usage: ssl_client2 param=<>...\n" \
|
||||
"\n acceptable parameters:\n" \
|
||||
" server_name=%%s default: localhost\n" \
|
||||
" rec_server_name=%%s default: localhost\n" \
|
||||
" server_addr=%%s default: given by name\n" \
|
||||
" server_port=%%d default: 4433\n" \
|
||||
" request_page=%%s default: \".\"\n" \
|
||||
|
@ -406,6 +405,7 @@ int main( void )
|
|||
" exchanges=%%d default: 1\n" \
|
||||
" reconnect=%%d number of reconnections using session resumption\n" \
|
||||
" default: 0 (disabled)\n" \
|
||||
" reco_server_name=%%s default: localhost\n" \
|
||||
" reco_delay=%%d default: 0 seconds\n" \
|
||||
" reco_mode=%%d 0: copy session, 1: serialize session\n" \
|
||||
" default: 1\n" \
|
||||
|
@ -456,7 +456,6 @@ int main( void )
|
|||
struct options
|
||||
{
|
||||
const char *server_name; /* hostname of the server (client only) */
|
||||
const char *rec_s_name; /* hostname of the server (re-connect) */
|
||||
const char *server_addr; /* address of the server (client only) */
|
||||
const char *server_port; /* port on which the ssl service runs */
|
||||
int debug_level; /* level of debugging */
|
||||
|
@ -500,6 +499,7 @@ struct options
|
|||
int recsplit; /* enable record splitting? */
|
||||
int dhmlen; /* minimum DHM params len in bits */
|
||||
int reconnect; /* attempt to resume session */
|
||||
const char *reco_server_name; /* hostname of the server (re-connect) */
|
||||
int reco_delay; /* delay in seconds before resuming session */
|
||||
int reco_mode; /* how to keep the session around */
|
||||
int reconnect_hard; /* unexpectedly reconnect from the same port */
|
||||
|
@ -878,7 +878,6 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
|
||||
opt.server_name = DFL_SERVER_NAME;
|
||||
opt.rec_s_name = DFL_SERVER_NAME;
|
||||
opt.server_addr = DFL_SERVER_ADDR;
|
||||
opt.server_port = DFL_SERVER_PORT;
|
||||
opt.debug_level = DFL_DEBUG_LEVEL;
|
||||
|
@ -926,6 +925,7 @@ int main( int argc, char *argv[] )
|
|||
opt.recsplit = DFL_RECSPLIT;
|
||||
opt.dhmlen = DFL_DHMLEN;
|
||||
opt.reconnect = DFL_RECONNECT;
|
||||
opt.reco_server_name = DFL_SERVER_NAME;
|
||||
opt.reco_delay = DFL_RECO_DELAY;
|
||||
opt.reco_mode = DFL_RECO_MODE;
|
||||
opt.reconnect_hard = DFL_RECONNECT_HARD;
|
||||
|
@ -964,8 +964,6 @@ int main( int argc, char *argv[] )
|
|||
|
||||
if( strcmp( p, "server_name" ) == 0 )
|
||||
opt.server_name = q;
|
||||
else if( strcmp( p, "rec_server_name" ) == 0 )
|
||||
opt.rec_s_name = q;
|
||||
else if( strcmp( p, "server_addr" ) == 0 )
|
||||
opt.server_addr = q;
|
||||
else if( strcmp( p, "server_port" ) == 0 )
|
||||
|
@ -1124,6 +1122,8 @@ int main( int argc, char *argv[] )
|
|||
if( opt.reconnect < 0 || opt.reconnect > 2 )
|
||||
goto usage;
|
||||
}
|
||||
else if( strcmp( p, "rec_server_name" ) == 0 )
|
||||
opt.reco_server_name = q;
|
||||
else if( strcmp( p, "reco_delay" ) == 0 )
|
||||
{
|
||||
opt.reco_delay = atoi( q );
|
||||
|
@ -3120,7 +3120,7 @@ reconnect:
|
|||
|
||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||
if( ( ret = mbedtls_ssl_reset_hostname( &ssl, opt.server_name,
|
||||
opt.rec_s_name ) ) != 0 )
|
||||
opt.reco_server_name ) ) != 0 )
|
||||
{
|
||||
mbedtls_printf( " failed\n ! mbedtls_ssl_reset_hostname returned %d\n\n",
|
||||
ret );
|
||||
|
|
Loading…
Reference in a new issue