Merge pull request #3023 from kaleb-himes/GH2998-REWORK

cleanup GET messages
This commit is contained in:
JacobBarthelmeh
2020-06-25 10:22:09 -06:00
committed by GitHub
2 changed files with 17 additions and 14 deletions

View File

@ -1376,6 +1376,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;
@ -1390,11 +1393,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];
@ -2750,8 +2753,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));
@ -3117,14 +3120,14 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#endif /* HAVE_SECURE_RENEGOTIATION */ #endif /* HAVE_SECURE_RENEGOTIATION */
if (sendGET) { if (sendGET) {
char msgGet[GETMSGSZ] = "GET /index.html HTTP/1.0\r\n\r\n";
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");
XSTRNCPY(msg, "GET /index.html HTTP/1.0\r\n\r\n", msgSz);
msg[msgSz] = '\0';
resumeSz = msgSz; XMEMSET(msg, 0, MSG32);
XSTRNCPY(resumeMsg, "GET /index.html HTTP/1.0\r\n\r\n", resumeSz); XMEMSET(resumeMsg, 0, MSG32);
resumeMsg[resumeSz] = '\0'; msgSz = resumeSz = (int) XSTRLEN(msgGet);
XMEMCPY(msg, msgGet, msgSz);
XMEMCPY(resumeMsg, msgGet, resumeSz);
} }
/* allow some time for exporting the session */ /* allow some time for exporting the session */

View File

@ -2428,11 +2428,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 = (int) XSTRLEN(msg);
} }
else { else {
write_msg = webServerMsg; write_msg = webServerMsg;
write_msg_sz = sizeof(webServerMsg); write_msg_sz = (int) XSTRLEN(webServerMsg);
} }
ServerWrite(ssl, write_msg, write_msg_sz); ServerWrite(ssl, write_msg, write_msg_sz);