mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-04 00:00:14 -04:00
fetcher: Remove unused FETCH_HTTP_VERSION_1_0 option
Was only used by the removed scepclient and does not serve any purpose nowadays anyway.
This commit is contained in:
parent
82adb5ce0f
commit
e864b8a8b1
@ -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
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
);
|
||||
|
@ -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",
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user