]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
fetcher: Remove unused FETCH_HTTP_VERSION_1_0 option
authorTobias Brunner <tobias@strongswan.org>
Tue, 3 Jun 2025 15:37:24 +0000 (17:37 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 4 Jun 2025 17:07:22 +0000 (19:07 +0200)
Was only used by the removed scepclient and does not serve any purpose
nowadays anyway.

src/libstrongswan/fetcher/fetcher.h
src/libstrongswan/fetcher/fetcher_manager.c
src/libstrongswan/plugins/curl/curl_fetcher.c
src/libstrongswan/plugins/soup/soup_fetcher.c
src/libstrongswan/plugins/winhttp/winhttp_fetcher.c
src/libstrongswan/tests/suites/test_fetch_http.c

index b4bd78809f0c56b0c63664f6ec4ba20ef9fbfaf5..dc8e16a73d93218b268202e4e40ae22cadc00752 100644 (file)
@@ -69,12 +69,6 @@ enum fetcher_option_t {
         */
        FETCH_REQUEST_HEADER,
 
-       /**
-        * Use HTTP Version 1.0 instead of 1.1.
-        * No additional argument is needed.
-        */
-       FETCH_HTTP_VERSION_1_0,
-
        /**
         * Timeout to use for fetch, in seconds.
         * Additional argument is u_int
index fe371a6d6182e0b9668b3059856c703eeb5e3e8d..cd636f45a15dcfe5e4e6728bc7f0908d29e35ade 100644 (file)
@@ -103,9 +103,6 @@ METHOD(fetcher_manager_t, fetch, status_t,
                                        good = fetcher->set_option(fetcher, opt,
                                                                                        va_arg(args, char*));
                                        continue;
-                               case FETCH_HTTP_VERSION_1_0:
-                                       good = fetcher->set_option(fetcher, opt);
-                                       continue;
                                case FETCH_TIMEOUT:
                                        good = fetcher->set_option(fetcher, opt,
                                                                                        va_arg(args, u_int));
index c788e3f68293b2096a3913be88cf375ce10514e6..80d989c2d0cb55e1becd81989cbda2dda9c5dcbd 100644 (file)
@@ -205,12 +205,6 @@ METHOD(fetcher_t, set_option, bool,
                        this->headers = curl_slist_append(this->headers, header);
                        break;
                }
-               case FETCH_HTTP_VERSION_1_0:
-               {
-                       curl_easy_setopt(this->curl, CURLOPT_HTTP_VERSION,
-                                                        CURL_HTTP_VERSION_1_0);
-                       break;
-               }
                case FETCH_TIMEOUT:
                {
                        this->timeout = va_arg(args, u_int);
index 072dfd7b25e27189610d7563df68b67bf4feb7b6..40b92e14ff88ccc6c734f80578adea7644a5edce 100644 (file)
@@ -55,11 +55,6 @@ struct private_soup_fetcher_t {
         */
        u_int timeout;
 
-       /**
-        * HTTP request version
-        */
-       SoupHTTPVersion version;
-
        /**
         * Fetcher callback function
         */
@@ -116,7 +111,6 @@ METHOD(fetcher_t, fetch, status_t,
                soup_message_set_request(message, this->type, SOUP_MEMORY_STATIC,
                                                                 this->data.ptr, this->data.len);
        }
-       soup_message_set_http_version(message, this->version);
        soup_message_body_set_accumulate(message->response_body, FALSE);
        g_signal_connect(message, "got-chunk", G_CALLBACK(soup_cb), &data);
        data.session = soup_session_new();
@@ -158,9 +152,6 @@ METHOD(fetcher_t, set_option, bool,
                case FETCH_REQUEST_TYPE:
                        this->type = va_arg(args, char*);
                        break;
-               case FETCH_HTTP_VERSION_1_0:
-                       this->version = SOUP_HTTP_1_0;
-                       break;
                case FETCH_TIMEOUT:
                        this->timeout = va_arg(args, u_int);
                        break;
@@ -200,7 +191,6 @@ soup_fetcher_t *soup_fetcher_create()
                        },
                },
                .method = SOUP_METHOD_GET,
-               .version = SOUP_HTTP_1_1,
                .timeout = DEFAULT_TIMEOUT,
                .cb = fetcher_default_callback,
        );
index e387bbb937e306e6324bb31f6194ffaae9356e8b..0be9b3eff6f4d39e1d3fa1f241e8acdf1b144a6d 100644 (file)
@@ -54,11 +54,6 @@ struct private_winhttp_fetcher_t {
         */
        chunk_t request;
 
-       /**
-        * HTTP version string to use
-        */
-       LPWSTR version;
-
        /**
         * Optional HTTP headers, as allocated LPWSTR
         */
@@ -264,7 +259,7 @@ METHOD(fetcher_t, fetch, status_t,
                connection = WinHttpConnect(this->session, host, port, 0);
                if (connection)
                {
-                       request = WinHttpOpenRequest(connection, method, path, this->version,
+                       request = WinHttpOpenRequest(connection, method, path, NULL,
                                                                                 WINHTTP_NO_REFERER,
                                                                                 WINHTTP_DEFAULT_ACCEPT_TYPES, flags);
                        if (request)
@@ -334,9 +329,6 @@ METHOD(fetcher_t, set_option, bool,
                case FETCH_REQUEST_HEADER:
                        supported = append_header(this, va_arg(args, char*));
                        break;
-               case FETCH_HTTP_VERSION_1_0:
-                       this->version = L"HTTP/1.0";
-                       break;
                case FETCH_TIMEOUT:
                        this->timeout = va_arg(args, u_int) * 1000;
                        break;
@@ -381,7 +373,6 @@ winhttp_fetcher_t *winhttp_fetcher_create()
                                .destroy = _destroy,
                        },
                },
-               .version = L"HTTP/1.1",
                .cb = fetcher_default_callback,
                .headers = linked_list_create(),
                .session = WinHttpOpen(L"strongSwan WinHTTP fetcher",
index b087a1e791ac4a4fd38f1fb5a14c209f9699bbd5..38460297c6162c057f8dcde69f38793c545c2290 100644 (file)
@@ -27,8 +27,6 @@
 typedef struct {
        /* HTTP Method */
        char *meth;
-       /* HTTP 1.x minor version */
-       int minor;
        /* host to connect to */
        char *host;
        /* HTTP service port */
@@ -117,8 +115,8 @@ static bool servicing(void *data, stream_t *stream)
                        switch (nr++)
                        {
                                case 0:
-                                       snprintf(hdr, sizeof(hdr), "%s %s HTTP/1.%u",
-                                                        test->meth, test->path, test->minor);
+                                       snprintf(hdr, sizeof(hdr), "%s %s HTTP/1.1",
+                                                        test->meth, test->path);
                                        ck_assert_str_eq(hdr, start);
                                        break;
                                default:
@@ -158,7 +156,7 @@ static bool servicing(void *data, stream_t *stream)
        }
 
        /* response headers */
-       snprintf(buf, sizeof(buf), "HTTP/1.%u %u OK\r\n", test->minor, test->code);
+       snprintf(buf, sizeof(buf), "HTTP/1.1 %u OK\r\n", test->code);
        ck_assert(stream->write_all(stream, buf, strlen(buf)));
 
        /* if the response code indicates an error the following write operations
@@ -188,13 +186,13 @@ static bool servicing(void *data, stream_t *stream)
 }
 
 static test_service_t gtests[] = {
-       { "GET", 1, "127.0.0.1", 6543, "/a/test/?b=c", NULL,
+       { "GET", "127.0.0.1", 6543, "/a/test/?b=c", NULL,
          NULL, 0, "\x12\x34", 2, 0 },
-       { "GET", 0, "localhost", 6543, "/", NULL,
+       { "GET", "localhost", 6543, "/", NULL,
          NULL, 0, NULL, 0, 0 },
-       { "GET", 0, "127.0.0.1", 6543, "/largefile", NULL,
+       { "GET", "127.0.0.1", 6543, "/largefile", NULL,
          NULL, 0, large, sizeof(large), 0 },
-       { "GET", 1, "[::1]", 6543, "/ipv6-url", NULL,
+       { "GET", "[::1]", 6543, "/ipv6-url", NULL,
          NULL, 0, "\x00\r\n\r\x00testdatablabla", 20, 0 },
 };
 
@@ -214,9 +212,7 @@ START_TEST(test_get)
 
        snprintf(uri, sizeof(uri), "http://%s:%u%s",
                         gtests[_i].host, gtests[_i].port, gtests[_i].path);
-       status = lib->fetcher->fetch(lib->fetcher, uri, &data,
-                       !gtests[_i].minor ? FETCH_HTTP_VERSION_1_0 : FETCH_END,
-                       FETCH_END);
+       status = lib->fetcher->fetch(lib->fetcher, uri, &data, FETCH_END);
        ck_assert_int_eq(status, SUCCESS);
        expected = chunk_create(gtests[_i].res, gtests[_i].res_len);
        ck_assert_msg(chunk_compare(expected, data) == 0,
@@ -229,11 +225,11 @@ END_TEST
 
 
 static test_service_t ptests[] = {
-       { "POST", 1, "127.0.0.1", 6543, "/a/test/?b=c", "application/binary",
+       { "POST", "127.0.0.1", 6543, "/a/test/?b=c", "application/binary",
          "\x23\x45", 2, "\x12\x34", 2, 0 },
-       { "POST", 0, "localhost", 6543, "/largefile", "application/x-large",
+       { "POST", "localhost", 6543, "/largefile", "application/x-large",
          large, sizeof(large), large, sizeof(large), 0 },
-       { "POST", 1, "[::1]", 6543, "/ipv6-url", "text/plain",
+       { "POST", "[::1]", 6543, "/ipv6-url", "text/plain",
          "\x00\r\n\r\x00testdatablabla", 20, "\x00\r\n\r\x00testdatablabla", 20, 0 },
 };
 
@@ -257,7 +253,6 @@ START_TEST(test_post)
                                        FETCH_REQUEST_TYPE, ptests[_i].type,
                                        FETCH_REQUEST_DATA,
                                                chunk_create(ptests[_i].req, ptests[_i].req_len),
-                                       !ptests[_i].minor ? FETCH_HTTP_VERSION_1_0 : FETCH_END,
                                        FETCH_END);
        ck_assert_int_eq(status, SUCCESS);
        expected = chunk_create(ptests[_i].res, ptests[_i].res_len);
@@ -271,11 +266,11 @@ END_TEST
 
 
 static test_service_t rtests[] = {
-       { "GET", 1, "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 200 },
-       { "GET", 1, "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 204 },
-       { "GET", 1, "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 400 },
-       { "GET", 1, "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 404 },
-       { "GET", 1, "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 500 },
+       { "GET", "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 200 },
+       { "GET", "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 204 },
+       { "GET", "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 400 },
+       { "GET", "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 404 },
+       { "GET", "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 500 },
 };
 
 START_TEST(test_response_code)