Updated to use TLSv1.2. Changed the string scanning to play better with other echo servers.

This commit is contained in:
John Safranek
2012-06-30 15:51:18 -07:00
parent b1e39f66a3
commit be4ce974d0

View File

@@ -69,7 +69,7 @@ void echoclient_test(void* args)
#if defined(CYASSL_DTLS) #if defined(CYASSL_DTLS)
method = DTLSv1_client_method(); method = DTLSv1_client_method();
#elif !defined(NO_TLS) #elif !defined(NO_TLS)
method = TLSv1_client_method(); method = TLSv1_2_client_method();
#else #else
method = SSLv3_client_method(); method = SSLv3_client_method();
#endif #endif
@@ -105,7 +105,7 @@ void echoclient_test(void* args)
while (fgets(send, sizeof(send), fin)) { while (fgets(send, sizeof(send), fin)) {
sendSz = (int)strlen(send) + 1; sendSz = (int)strlen(send);
if (SSL_write(ssl, send, sendSz) != sendSz) if (SSL_write(ssl, send, sendSz) != sendSz)
err_sys("SSL_write failed"); err_sys("SSL_write failed");
@@ -115,7 +115,7 @@ void echoclient_test(void* args)
break; break;
} }
if (strncmp(send, "break", 4) == 0) { if (strncmp(send, "break", 5) == 0) {
fputs("sending server session close: break!\n", fout); fputs("sending server session close: break!\n", fout);
break; break;
} }
@@ -123,6 +123,7 @@ void echoclient_test(void* args)
while (sendSz) { while (sendSz) {
int got; int got;
if ( (got = SSL_read(ssl, reply, sizeof(reply))) > 0) { if ( (got = SSL_read(ssl, reply, sizeof(reply))) > 0) {
reply[got] = 0;
fputs(reply, fout); fputs(reply, fout);
sendSz -= got; sendSz -= got;
} }
@@ -165,6 +166,9 @@ void echoclient_test(void* args)
args.argv = argv; args.argv = argv;
CyaSSL_Init(); CyaSSL_Init();
#ifdef DEBUG_CYASSL
CyaSSL_Debugging_ON();
#endif
if (CurrentDir("echoclient") || CurrentDir("build")) if (CurrentDir("echoclient") || CurrentDir("build"))
ChangeDirBack(2); ChangeDirBack(2);
echoclient_test(&args); echoclient_test(&args);