From: Viktor Szakats Date: Wed, 29 Oct 2025 12:31:23 +0000 (+0100) Subject: http: fix `-Wunreachable-code` in !websockets !unity builds X-Git-Tag: curl-8_17_0~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7973cb0b3ef2f2de677e65bc29062c122536262b;p=thirdparty%2Fcurl.git http: fix `-Wunreachable-code` in !websockets !unity builds Also requires non-unity build. Possibly more non-default options are necessary to reproduce. Seen with llvm/clang. ``` lib/http.c:1856:15: error: code will never be executed [-Werror,-Wunreachable-code] 1856 | httpreq = HTTPREQ_GET; | ^~~~~~~~~~~ 1 error generated. ``` Closes #19275 --- diff --git a/lib/http.c b/lib/http.c index 0b55796dc5..b8a4edef61 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1852,9 +1852,12 @@ void Curl_http_method(struct Curl_easy *data, { Curl_HttpReq httpreq = (Curl_HttpReq)data->state.httpreq; const char *request; +#ifndef CURL_DISABLE_WEBSOCKETS if(data->conn->handler->protocol&(CURLPROTO_WS|CURLPROTO_WSS)) httpreq = HTTPREQ_GET; - else if((data->conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_FTP)) && + else +#endif + if((data->conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_FTP)) && data->state.upload) httpreq = HTTPREQ_PUT;