diff --git a/docs/doxygen/include/size_table.md b/docs/doxygen/include/size_table.md index 64dccdd3..fed45453 100644 --- a/docs/doxygen/include/size_table.md +++ b/docs/doxygen/include/size_table.md @@ -9,7 +9,7 @@ core_http_client.c -
3.1K
+
3.2K
2.5K
@@ -29,7 +29,7 @@ Total estimates -
23.9K
+
24.0K
20.7K
diff --git a/source/core_http_client.c b/source/core_http_client.c index 2ea4d04d..f5693eac 100644 --- a/source/core_http_client.c +++ b/source/core_http_client.c @@ -1632,12 +1632,15 @@ HTTPStatus_t HTTPClient_InitializeRequestHeaders( HTTPRequestHeaders_t * pReques if( returnStatus == HTTPSuccess ) { - /* Write "User-Agent: ". */ - returnStatus = addHeader( pRequestHeaders, - HTTP_USER_AGENT_FIELD, - HTTP_USER_AGENT_FIELD_LEN, - HTTP_USER_AGENT_VALUE, - HTTP_USER_AGENT_VALUE_LEN ); + if( ( HTTP_REQUEST_NO_USER_AGENT_FLAG & pRequestInfo->reqFlags ) == 0U ) + { + /* Write "User-Agent: ". */ + returnStatus = addHeader( pRequestHeaders, + HTTP_USER_AGENT_FIELD, + HTTP_USER_AGENT_FIELD_LEN, + HTTP_USER_AGENT_VALUE, + HTTP_USER_AGENT_VALUE_LEN ); + } } if( returnStatus == HTTPSuccess ) diff --git a/source/include/core_http_client.h b/source/include/core_http_client.h index 3425f7e0..96f2d1bd 100644 --- a/source/include/core_http_client.h +++ b/source/include/core_http_client.h @@ -111,7 +111,18 @@ * * This flag is valid only for #HTTPRequestInfo_t reqFlags parameter. */ -#define HTTP_REQUEST_KEEP_ALIVE_FLAG 0x1U +#define HTTP_REQUEST_KEEP_ALIVE_FLAG 0x1U + +/** + * @ingroup http_request_flags + * @brief Set this flag to skip the User-Agent in the request headers. + * + * Setting this will cause the "User-Agent: " to be omitted in the + * request headers. + * + * This flag is valid only for #HTTPRequestInfo_t reqFlags parameter. + */ +#define HTTP_REQUEST_NO_USER_AGENT_FLAG 0x2U /** * @defgroup http_response_flags HTTPResponse_t Flags