]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl.h: switch `CURL_HTTP_VERSION*` enums to long constants
authorViktor Szakats <commit@vsz.me>
Wed, 5 Mar 2025 21:32:28 +0000 (22:32 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 6 Mar 2025 00:01:24 +0000 (01:01 +0100)
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

.github/workflows/macos.yml
include/curl/curl.h
tests/libtest/lib1901.c

index 0a8b33aab9f2b0b1448df55bbfed922acba2c82b..2d825916e1838729b99945e9cccb8dea23e46c21 100644 (file)
@@ -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'* || \
index 8e62310b9d19ed5c155fa277971ac335fe1e5ac2..81dbab379146106273412a376f1916e40ded062f 100644 (file)
@@ -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
index 314f0354d8ffd16169f9b4589961d61c9401efef..6d5f3d4aa024be881a1b587e70741b4f1987a507 100644 (file)
@@ -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);