From: Viktor Szakats Date: Wed, 5 Mar 2025 21:32:28 +0000 (+0100) Subject: curl.h: switch `CURL_HTTP_VERSION*` enums to long constants X-Git-Tag: curl-8_13_0~253 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fd54bed51a8083cd83fa55fd4d09b0e59f695006;p=thirdparty%2Fcurl.git curl.h: switch `CURL_HTTP_VERSION*` enums to long constants It fixes tests 1539, and 2402, 2404 (for non-Secure Transport), on macOS with the gcc compiler. Also unignore these tests in GHA/macos for non-secure transport. Ref: c349bd668c91f2484ae21c0f361ddf497143093c #14097 (issue 15.) Ref: 7b0240c07799c28dc84272f9e38e1092ce4cc498 #16539 Ref: 2ec00372a1fc7f27cd3a6c43e29007400acfe2b6 #16482 Closes #16580 --- diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 0a8b33aab9..2d825916e1 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -315,7 +315,7 @@ jobs: if [ -z '${{ matrix.build.torture }}' ]; then TFLAGS+=' ~2037 ~2041' # flaky if [[ '${{ matrix.compiler }}' = 'gcc'* ]]; then - TFLAGS+=' ~1156 ~1539' # HTTP Content-Range, Content-Length + TFLAGS+=' ~1156' # HTTP Content-Range if [[ -n '${{ matrix.build.configure }}' || \ '${{ matrix.build.generate }}' = *'-DCURL_USE_SECTRANSP=ON'* ]]; then TFLAGS+=' ~2100' # 2100:'HTTP GET using DoH' https://github.com/curl/curl/actions/runs/9942146678/job/27462937524#step:15:5059 @@ -323,8 +323,6 @@ jobs: if [[ '${{ matrix.build.configure }}' = *'--with-secure-transport'* || \ '${{ matrix.build.generate }}' = *'-DCURL_USE_SECTRANSP=ON'* ]]; then TFLAGS+=' ~HTTP/2' # 2400 2401 2402 2403 2404 2406, Secure Transport + nghttp2 - else - TFLAGS+=' ~2402 ~2404' # non-Secure Transport + nghttp2 fi fi if [[ '${{ matrix.build.configure }}' = *'--with-secure-transport'* || \ diff --git a/include/curl/curl.h b/include/curl/curl.h index 8e62310b9d..81dbab3791 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -2293,26 +2293,25 @@ typedef enum { /* Convenient "aliases" */ #define CURLOPT_RTSPHEADER CURLOPT_HTTPHEADER - /* These enums are for use with the CURLOPT_HTTP_VERSION option. */ -enum { - CURL_HTTP_VERSION_NONE, /* setting this means we do not care, and that we - would like the library to choose the best - possible for us! */ - CURL_HTTP_VERSION_1_0, /* please use HTTP 1.0 in the request */ - CURL_HTTP_VERSION_1_1, /* please use HTTP 1.1 in the request */ - CURL_HTTP_VERSION_2_0, /* please use HTTP 2 in the request */ - CURL_HTTP_VERSION_2TLS, /* use version 2 for HTTPS, version 1.1 for HTTP */ - CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE, /* please use HTTP 2 without HTTP/1.1 - Upgrade */ - CURL_HTTP_VERSION_3 = 30, /* Use HTTP/3, fallback to HTTP/2 or HTTP/1 if - needed. For HTTPS only. For HTTP, this option - makes libcurl return error. */ - CURL_HTTP_VERSION_3ONLY = 31, /* Use HTTP/3 without fallback. For HTTPS - only. For HTTP, this makes libcurl - return error. */ - - CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */ -}; +/* These constants are for use with the CURLOPT_HTTP_VERSION option. */ +#define CURL_HTTP_VERSION_NONE 0L /* setting this means we do not care, and + that we would like the library to choose + the best possible for us! */ +#define CURL_HTTP_VERSION_1_0 1L /* please use HTTP 1.0 in the request */ +#define CURL_HTTP_VERSION_1_1 2L /* please use HTTP 1.1 in the request */ +#define CURL_HTTP_VERSION_2_0 3L /* please use HTTP 2 in the request */ +#define CURL_HTTP_VERSION_2TLS 4L /* use version 2 for HTTPS, version 1.1 for + HTTP */ +#define CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE 5L /* please use HTTP 2 without + HTTP/1.1 Upgrade */ +#define CURL_HTTP_VERSION_3 30L /* Use HTTP/3, fallback to HTTP/2 or + HTTP/1 if needed. For HTTPS only. For + HTTP, this option makes libcurl + return error. */ +#define CURL_HTTP_VERSION_3ONLY 31L /* Use HTTP/3 without fallback. For + HTTPS only. For HTTP, this makes + libcurl return error. */ +#define CURL_HTTP_VERSION_LAST 32L /* *ILLEGAL* http version */ /* Convenience definition simple because the name of the version is HTTP/2 and not 2.0. The 2_0 version of the enum name was set while the version was diff --git a/tests/libtest/lib1901.c b/tests/libtest/lib1901.c index 314f0354d8..6d5f3d4aa0 100644 --- a/tests/libtest/lib1901.c +++ b/tests/libtest/lib1901.c @@ -70,7 +70,7 @@ CURLcode test(char *URL) easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); easy_setopt(curl, CURLOPT_POST, 1L); easy_setopt(curl, CURLOPT_VERBOSE, 1L); - easy_setopt(curl, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_1_1); + easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); easy_setopt(curl, CURLOPT_URL, URL); easy_setopt(curl, CURLOPT_READDATA, NULL);