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

View File

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