From 432454701ee4e5ce518d835a0b51314550c51564 Mon Sep 17 00:00:00 2001 From: V <36897290+cryi@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:03:30 +0100 Subject: [PATCH] Format (#3) * format --------- Co-authored-by: GitHub Action --- source/core_http_client.c | 14 +++++++++----- source/include/core_http_client.h | 16 ++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/source/core_http_client.c b/source/core_http_client.c index eafef123..128a1d51 100644 --- a/source/core_http_client.c +++ b/source/core_http_client.c @@ -872,9 +872,10 @@ static int httpParserOnHeadersCompleteCallback( llhttp_t * pHttpParser ) /* If there is HTTP_RESPONSE_DO_NOT_PARSE_BODY_FLAG opt-in we should stop * parsing here. */ - if ( pResponse->respOptionFlags & HTTP_RESPONSE_DO_NOT_PARSE_BODY_FLAG ) { + if( pResponse->respOptionFlags & HTTP_RESPONSE_DO_NOT_PARSE_BODY_FLAG ) + { shouldContinueParse = LLHTTP_PAUSE_PARSING; - pResponse->pBody = (const uint8_t*)pParsingContext->pBufferCur; + pResponse->pBody = ( const uint8_t * ) pParsingContext->pBufferCur; } return shouldContinueParse; @@ -1108,10 +1109,12 @@ static HTTPStatus_t processLlhttpError( const llhttp_t * pHttpParser ) "found when it shouldn't have been." ) ); returnStatus = HTTPSecurityAlertInvalidContentLength; break; + case HPE_PAUSED: - LogInfo(("User intervention: Parsing stopped by user.")); + LogInfo( ( "User intervention: Parsing stopped by user." ) ); returnStatus = HTTPParserPaused; break; + /* All other error cases cannot be triggered and indicate an error in the * third-party parsing library if found. */ default: @@ -2096,10 +2099,11 @@ HTTPStatus_t HTTPClient_ReceiveAndParseHttpResponse( const TransportInterface_t ( totalReceived < pResponse->bufferLen ) ) ? 1U : 0U; } - if ( returnStatus == HTTPParserPaused && pResponse->respOptionFlags & HTTP_RESPONSE_DO_NOT_PARSE_BODY_FLAG) { + if( ( returnStatus == HTTPParserPaused ) && pResponse->respOptionFlags & HTTP_RESPONSE_DO_NOT_PARSE_BODY_FLAG ) + { returnStatus = HTTPSuccess; /* There may be dangling data if we parse with do not parse body flag. To let libraries built on top of corehttp we expose it through body. */ - pResponse->bodyLen = totalReceived - ((uint8_t *)pResponse->pBody - pResponse->pBuffer); + pResponse->bodyLen = totalReceived - ( ( uint8_t * ) pResponse->pBody - pResponse->pBuffer ); } if( returnStatus == HTTPSuccess ) diff --git a/source/include/core_http_client.h b/source/include/core_http_client.h index 51065fc3..ebe92ca4 100644 --- a/source/include/core_http_client.h +++ b/source/include/core_http_client.h @@ -171,7 +171,7 @@ * * This flag is valid only for #HTTPResponse_t respOptionFlags parameter. */ -#define HTTP_RESPONSE_DO_NOT_PARSE_BODY_FLAG 0x1U +#define HTTP_RESPONSE_DO_NOT_PARSE_BODY_FLAG 0x1U /** * @ingroup http_constants @@ -185,7 +185,7 @@ * - When the requested range is for the last N bytes of the file. * In both cases, this value should be used for the "rangeEnd" parameter. */ -#define HTTP_RANGE_REQUEST_END_OF_FILE -1 +#define HTTP_RANGE_REQUEST_END_OF_FILE -1 /** * @ingroup http_enum_types @@ -322,12 +322,12 @@ typedef enum HTTPStatus HTTPParserPaused, /** - * @brief An error occurred in the third-party parsing library. - * - * Functions that may return this value: - * - #HTTPClient_Send - * - #HTTPClient_ReadHeader - */ + * @brief An error occurred in the third-party parsing library. + * + * Functions that may return this value: + * - #HTTPClient_Send + * - #HTTPClient_ReadHeader + */ HTTPParserInternalError, /**