cleanup GET messages

This commit is contained in:
kaleb-himes 2020-06-03 15:47:02 -06:00
parent dc1472692a
commit 8c3f7a77ca
2 changed files with 17 additions and 13 deletions

View File

@ -1371,6 +1371,9 @@ static void Usage(void)
#endif #endif
} }
#define MSG32 32
#define GETMSGSZ 29
THREAD_RETURN WOLFSSL_THREAD client_test(void* args) THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
{ {
SOCKET_T sockfd = WOLFSSL_SOCKET_INVALID; SOCKET_T sockfd = WOLFSSL_SOCKET_INVALID;
@ -1385,11 +1388,11 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
int flatSessionSz = 0; int flatSessionSz = 0;
#ifndef WOLFSSL_ALT_TEST_STRINGS #ifndef WOLFSSL_ALT_TEST_STRINGS
char msg[32] = "hello wolfssl!"; /* GET may make bigger */ char msg[MSG32] = "hello wolfssl!"; /* GET may make bigger */
char resumeMsg[32] = "resuming wolfssl!"; char resumeMsg[MSG32] = "resuming wolfssl!";
#else #else
char msg[32] = "hello wolfssl!\n"; char msg[MSG32] = "hello wolfssl!\n";
char resumeMsg[32] = "resuming wolfssl!\n"; char resumeMsg[MSG32] = "resuming wolfssl!\n";
#endif #endif
char reply[128]; char reply[128];
@ -2737,8 +2740,8 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
if (doMcast) { if (doMcast) {
#ifdef WOLFSSL_MULTICAST #ifdef WOLFSSL_MULTICAST
byte pms[512]; /* pre master secret */ byte pms[512]; /* pre master secret */
byte cr[32]; /* client random */ byte cr[MSG32]; /* client random */
byte sr[32]; /* server random */ byte sr[MSG32]; /* server random */
const byte suite[2] = {0, 0xfe}; /* WDM_WITH_NULL_SHA256 */ const byte suite[2] = {0, 0xfe}; /* WDM_WITH_NULL_SHA256 */
XMEMSET(pms, 0x23, sizeof(pms)); XMEMSET(pms, 0x23, sizeof(pms));
@ -3075,13 +3078,14 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
if (sendGET) { if (sendGET) {
printf("SSL connect ok, sending GET...\n"); printf("SSL connect ok, sending GET...\n");
msgSz = sizeof("GET /index.html HTTP/1.0\r\n\r\n"); char msgGet[GETMSGSZ] = "GET /index.html HTTP/1.0\r\n\r\n";
XSTRNCPY(msg, "GET /index.html HTTP/1.0\r\n\r\n", msgSz); XMEMSET(msg, 0, MSG32);
msg[msgSz] = '\0'; XMEMSET(resumeMsg, 0, MSG32);
msgSz = GETMSGSZ-1;
XSTRNCPY(msg, msgGet, msgSz);
resumeSz = msgSz; resumeSz = msgSz;
XSTRNCPY(resumeMsg, "GET /index.html HTTP/1.0\r\n\r\n", resumeSz); XSTRNCPY(resumeMsg, msgGet, resumeSz);
resumeMsg[resumeSz] = '\0';
} }
/* allow some time for exporting the session */ /* allow some time for exporting the session */

View File

@ -2404,11 +2404,11 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
/* Write data */ /* Write data */
if (!useWebServerMsg) { if (!useWebServerMsg) {
write_msg = msg; write_msg = msg;
write_msg_sz = sizeof(msg); write_msg_sz = XSTRLEN(msg);
} }
else { else {
write_msg = webServerMsg; write_msg = webServerMsg;
write_msg_sz = sizeof(webServerMsg); write_msg_sz = XSTRLEN(webServerMsg);
} }
ServerWrite(ssl, write_msg, write_msg_sz); ServerWrite(ssl, write_msg, write_msg_sz);