From e1f78ce25b86bd3a1db2f08918114bb0eae46ecc Mon Sep 17 00:00:00 2001 From: Kvarec Lezki Date: Thu, 2 Feb 2023 16:37:42 +0500 Subject: [PATCH] http: fix "part of conditional expression is always false" [CWE-570] V560: A part of conditional expression is always false: conn->bits.authneg. [CWE-570] V560: A part of conditional expression is always false: conn->handler->protocol & (0 | 0). https://pvs-studio.com/en/docs/warnings/v560/ Closes #10399 --- lib/http.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/http.c b/lib/http.c index 4d4f4fe876..3eba1a3753 100644 --- a/lib/http.c +++ b/lib/http.c @@ -2396,8 +2396,7 @@ CURLcode Curl_http_bodysend(struct Curl_easy *data, struct connectdata *conn, we don't upload data chunked, as RFC2616 forbids us to set both kinds of headers (Transfer-Encoding: chunked and Content-Length) */ if(http->postsize != -1 && !data->req.upload_chunky && - (conn->bits.authneg || - !Curl_checkheaders(data, STRCONST("Content-Length")))) { + (!Curl_checkheaders(data, STRCONST("Content-Length")))) { /* we allow replacing this header if not during auth negotiation, although it isn't very wise to actually set your own */ result = Curl_dyn_addf(r, @@ -3171,8 +3170,10 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done) } result = Curl_http_cookies(data, conn, &req); +#ifdef USE_WEBSOCKETS if(!result && conn->handler->protocol&(CURLPROTO_WS|CURLPROTO_WSS)) result = Curl_ws_request(data, &req); +#endif if(!result) result = Curl_add_timecondition(data, &req); if(!result) -- 2.47.2