Skip to content

Commit 4127014

Browse files
authored
log response, particularly in case of failure (#1314)
* add the call response, it's verbose but maybe we should make it debug * WARN level log when result is not 200 and VERBOSE for 200s * missing null terminator * alloc right amount to include null char
1 parent d08634b commit 4127014

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/source/Signaling/LwsApiCalls.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,15 @@ INT32 lwsHttpCallbackRoutine(struct lws* wsi, enum lws_callback_reasons reason,
111111
lwsl_hexdump_debug(pDataIn, dataSize);
112112

113113
if (dataSize != 0) {
114-
CHK(NULL != (pLwsCallInfo->callInfo.responseData = (PCHAR) MEMALLOC(dataSize)), STATUS_NOT_ENOUGH_MEMORY);
114+
CHK(NULL != (pLwsCallInfo->callInfo.responseData = (PCHAR) MEMALLOC(dataSize+1)), STATUS_NOT_ENOUGH_MEMORY);
115115
MEMCPY(pLwsCallInfo->callInfo.responseData, pDataIn, dataSize);
116116
pLwsCallInfo->callInfo.responseDataLen = (UINT32) dataSize;
117+
pLwsCallInfo->callInfo.responseData[dataSize] = '\0';
118+
if (pLwsCallInfo->callInfo.callResult != SERVICE_CALL_RESULT_OK) {
119+
DLOGW("Received client http read response: %s", pLwsCallInfo->callInfo.responseData);
120+
} else {
121+
DLOGV("Received client http read response: %s", pLwsCallInfo->callInfo.responseData);
122+
}
117123
}
118124

119125
break;

0 commit comments

Comments
 (0)