@@ -936,7 +936,8 @@ static const char* server_usage_msg[][65] = {
936936 "-Q Request certificate from client post-handshake\n" , /* 49 */
937937#endif
938938#ifdef WOLFSSL_SEND_HRR_COOKIE
939- "-J Server sends Cookie Extension containing state\n" , /* 50 */
939+ "-J [n] Server sends Cookie Extension containing state (n to "
940+ "disable)\n" , /* 50 */
940941#endif
941942#endif /* WOLFSSL_TLS13 */
942943#ifdef WOLFSSL_EARLY_DATA
@@ -1702,7 +1703,7 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
17021703 /* Not Used: h, z, W, X */
17031704 while ((ch = mygetopt_long (argc , argv , "?:"
17041705 "abc:defgijk:l:mop:q:rstu;v:wxy"
1705- "A:B:C:D:E:FGH:IJKL :MNO:PQR:S:T;UVYZ:"
1706+ "A:B:C:D:E:FGH:IJ;KL :MNO:PQR:S:T;UVYZ:"
17061707 "01:23:4:567:89"
17071708 "@#" , long_options , 0 )) != -1 ) {
17081709 switch (ch ) {
@@ -2085,6 +2086,8 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
20852086 case 'J' :
20862087 #ifdef WOLFSSL_SEND_HRR_COOKIE
20872088 hrrCookie = 1 ;
2089+ if (XSTRCMP (myoptarg , "n" ) == 0 )
2090+ hrrCookie = -1 ;
20882091 #endif
20892092 break ;
20902093
@@ -2959,10 +2962,13 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
29592962#endif /* !NO_CERTS */
29602963
29612964#ifdef WOLFSSL_SEND_HRR_COOKIE
2962- if (hrrCookie && wolfSSL_send_hrr_cookie (ssl , NULL , 0 )
2965+ if (hrrCookie == 1 && wolfSSL_send_hrr_cookie (ssl , NULL , 0 )
29632966 != WOLFSSL_SUCCESS ) {
29642967 err_sys ("unable to set use of cookie with HRR msg" );
29652968 }
2969+ else if (hrrCookie == -1 ) {
2970+ wolfSSL_disable_hrr_cookie (ssl );
2971+ }
29662972#endif
29672973
29682974#if defined(WOLFSSL_STATIC_MEMORY ) && defined(DEBUG_WOLFSSL )
0 commit comments