Fixes from peer review. Thanks

pull/224/head
David Garske 2022-06-01 09:47:14 -07:00
parent 345b90e5f0
commit 6e65dba8ce
1 changed files with 6 additions and 4 deletions

View File

@ -45,7 +45,6 @@ static int io_timeout_sec = DEFAULT_TIMEOUT_SEC;
static SOCKET_T sfd = SOCKET_INVALID; static SOCKET_T sfd = SOCKET_INVALID;
static word16 port; static word16 port;
static int ret = -1;
static char path[MAX_URL_ITEM_SIZE]; static char path[MAX_URL_ITEM_SIZE];
static char domainName[MAX_URL_ITEM_SIZE]; static char domainName[MAX_URL_ITEM_SIZE];
static int nonBlockCnt = 0; static int nonBlockCnt = 0;
@ -55,15 +54,17 @@ static byte* httpBuf;
static int OcspLookupNonBlockCb(void* ctx, const char* url, int urlSz, static int OcspLookupNonBlockCb(void* ctx, const char* url, int urlSz,
byte* ocspReqBuf, int ocspReqSz, byte** ocspRespBuf) byte* ocspReqBuf, int ocspReqSz, byte** ocspRespBuf)
{ {
int ret = WOLFSSL_CBIO_ERR_GENERAL;
if (sfd != SOCKET_INVALID) { if (sfd != SOCKET_INVALID) {
ret = wolfIO_HttpProcessResponseOcsp(sfd, ocspRespBuf, ret = wolfIO_HttpProcessResponseOcsp(sfd, ocspRespBuf,
httpBuf, HTTP_SCRATCH_BUFFER_SIZE, ctx); httpBuf, HTTP_SCRATCH_BUFFER_SIZE, NULL);
nonBlockCnt++; nonBlockCnt++;
if (ret == OCSP_WANT_READ) if (ret == OCSP_WANT_READ)
return WOLFSSL_CBIO_ERR_WANT_READ; return WOLFSSL_CBIO_ERR_WANT_READ;
printf("OCSP Response: ret %d, nonblock count %d\n", printf("OCSP Response: ret %d, nonblock count %d\n",
ret, nonBlockCnt); ret, nonBlockCnt);
XFREE(httpBuf, ctx, DYNAMIC_TYPE_OCSP); XFREE(httpBuf, NULL, DYNAMIC_TYPE_OCSP);
httpBuf = NULL; httpBuf = NULL;
return ret; return ret;
} }
@ -126,10 +127,11 @@ static int OcspLookupNonBlockCb(void* ctx, const char* url, int urlSz,
} }
if (sfd != SOCKET_INVALID) if (sfd != SOCKET_INVALID)
CloseSocket(sfd); CloseSocket(sfd);
XFREE(httpBuf, ctx, DYNAMIC_TYPE_OCSP); XFREE(httpBuf, NULL, DYNAMIC_TYPE_OCSP);
httpBuf = NULL; httpBuf = NULL;
} }
} }
(void)ctx;
printf("Resp ret: %d\n", ret); printf("Resp ret: %d\n", ret);
return ret; return ret;
} }