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:
@@ -69,12 +69,6 @@ enum fetcher_option_t {
|
|||||||
*/
|
*/
|
||||||
FETCH_REQUEST_HEADER,
|
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.
|
* Timeout to use for fetch, in seconds.
|
||||||
* Additional argument is u_int
|
* Additional argument is u_int
|
||||||
|
|||||||
@@ -103,9 +103,6 @@ METHOD(fetcher_manager_t, fetch, status_t,
|
|||||||
good = fetcher->set_option(fetcher, opt,
|
good = fetcher->set_option(fetcher, opt,
|
||||||
va_arg(args, char*));
|
va_arg(args, char*));
|
||||||
continue;
|
continue;
|
||||||
case FETCH_HTTP_VERSION_1_0:
|
|
||||||
good = fetcher->set_option(fetcher, opt);
|
|
||||||
continue;
|
|
||||||
case FETCH_TIMEOUT:
|
case FETCH_TIMEOUT:
|
||||||
good = fetcher->set_option(fetcher, opt,
|
good = fetcher->set_option(fetcher, opt,
|
||||||
va_arg(args, u_int));
|
va_arg(args, u_int));
|
||||||
|
|||||||
@@ -205,12 +205,6 @@ METHOD(fetcher_t, set_option, bool,
|
|||||||
this->headers = curl_slist_append(this->headers, header);
|
this->headers = curl_slist_append(this->headers, header);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FETCH_HTTP_VERSION_1_0:
|
|
||||||
{
|
|
||||||
curl_easy_setopt(this->curl, CURLOPT_HTTP_VERSION,
|
|
||||||
CURL_HTTP_VERSION_1_0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case FETCH_TIMEOUT:
|
case FETCH_TIMEOUT:
|
||||||
{
|
{
|
||||||
this->timeout = va_arg(args, u_int);
|
this->timeout = va_arg(args, u_int);
|
||||||
|
|||||||
@@ -55,11 +55,6 @@ struct private_soup_fetcher_t {
|
|||||||
*/
|
*/
|
||||||
u_int timeout;
|
u_int timeout;
|
||||||
|
|
||||||
/**
|
|
||||||
* HTTP request version
|
|
||||||
*/
|
|
||||||
SoupHTTPVersion version;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetcher callback function
|
* Fetcher callback function
|
||||||
*/
|
*/
|
||||||
@@ -116,7 +111,6 @@ METHOD(fetcher_t, fetch, status_t,
|
|||||||
soup_message_set_request(message, this->type, SOUP_MEMORY_STATIC,
|
soup_message_set_request(message, this->type, SOUP_MEMORY_STATIC,
|
||||||
this->data.ptr, this->data.len);
|
this->data.ptr, this->data.len);
|
||||||
}
|
}
|
||||||
soup_message_set_http_version(message, this->version);
|
|
||||||
soup_message_body_set_accumulate(message->response_body, FALSE);
|
soup_message_body_set_accumulate(message->response_body, FALSE);
|
||||||
g_signal_connect(message, "got-chunk", G_CALLBACK(soup_cb), &data);
|
g_signal_connect(message, "got-chunk", G_CALLBACK(soup_cb), &data);
|
||||||
data.session = soup_session_new();
|
data.session = soup_session_new();
|
||||||
@@ -158,9 +152,6 @@ METHOD(fetcher_t, set_option, bool,
|
|||||||
case FETCH_REQUEST_TYPE:
|
case FETCH_REQUEST_TYPE:
|
||||||
this->type = va_arg(args, char*);
|
this->type = va_arg(args, char*);
|
||||||
break;
|
break;
|
||||||
case FETCH_HTTP_VERSION_1_0:
|
|
||||||
this->version = SOUP_HTTP_1_0;
|
|
||||||
break;
|
|
||||||
case FETCH_TIMEOUT:
|
case FETCH_TIMEOUT:
|
||||||
this->timeout = va_arg(args, u_int);
|
this->timeout = va_arg(args, u_int);
|
||||||
break;
|
break;
|
||||||
@@ -200,7 +191,6 @@ soup_fetcher_t *soup_fetcher_create()
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
.method = SOUP_METHOD_GET,
|
.method = SOUP_METHOD_GET,
|
||||||
.version = SOUP_HTTP_1_1,
|
|
||||||
.timeout = DEFAULT_TIMEOUT,
|
.timeout = DEFAULT_TIMEOUT,
|
||||||
.cb = fetcher_default_callback,
|
.cb = fetcher_default_callback,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -54,11 +54,6 @@ struct private_winhttp_fetcher_t {
|
|||||||
*/
|
*/
|
||||||
chunk_t request;
|
chunk_t request;
|
||||||
|
|
||||||
/**
|
|
||||||
* HTTP version string to use
|
|
||||||
*/
|
|
||||||
LPWSTR version;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional HTTP headers, as allocated LPWSTR
|
* Optional HTTP headers, as allocated LPWSTR
|
||||||
*/
|
*/
|
||||||
@@ -264,7 +259,7 @@ METHOD(fetcher_t, fetch, status_t,
|
|||||||
connection = WinHttpConnect(this->session, host, port, 0);
|
connection = WinHttpConnect(this->session, host, port, 0);
|
||||||
if (connection)
|
if (connection)
|
||||||
{
|
{
|
||||||
request = WinHttpOpenRequest(connection, method, path, this->version,
|
request = WinHttpOpenRequest(connection, method, path, NULL,
|
||||||
WINHTTP_NO_REFERER,
|
WINHTTP_NO_REFERER,
|
||||||
WINHTTP_DEFAULT_ACCEPT_TYPES, flags);
|
WINHTTP_DEFAULT_ACCEPT_TYPES, flags);
|
||||||
if (request)
|
if (request)
|
||||||
@@ -334,9 +329,6 @@ METHOD(fetcher_t, set_option, bool,
|
|||||||
case FETCH_REQUEST_HEADER:
|
case FETCH_REQUEST_HEADER:
|
||||||
supported = append_header(this, va_arg(args, char*));
|
supported = append_header(this, va_arg(args, char*));
|
||||||
break;
|
break;
|
||||||
case FETCH_HTTP_VERSION_1_0:
|
|
||||||
this->version = L"HTTP/1.0";
|
|
||||||
break;
|
|
||||||
case FETCH_TIMEOUT:
|
case FETCH_TIMEOUT:
|
||||||
this->timeout = va_arg(args, u_int) * 1000;
|
this->timeout = va_arg(args, u_int) * 1000;
|
||||||
break;
|
break;
|
||||||
@@ -381,7 +373,6 @@ winhttp_fetcher_t *winhttp_fetcher_create()
|
|||||||
.destroy = _destroy,
|
.destroy = _destroy,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.version = L"HTTP/1.1",
|
|
||||||
.cb = fetcher_default_callback,
|
.cb = fetcher_default_callback,
|
||||||
.headers = linked_list_create(),
|
.headers = linked_list_create(),
|
||||||
.session = WinHttpOpen(L"strongSwan WinHTTP fetcher",
|
.session = WinHttpOpen(L"strongSwan WinHTTP fetcher",
|
||||||
|
|||||||
@@ -27,8 +27,6 @@
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
/* HTTP Method */
|
/* HTTP Method */
|
||||||
char *meth;
|
char *meth;
|
||||||
/* HTTP 1.x minor version */
|
|
||||||
int minor;
|
|
||||||
/* host to connect to */
|
/* host to connect to */
|
||||||
char *host;
|
char *host;
|
||||||
/* HTTP service port */
|
/* HTTP service port */
|
||||||
@@ -117,8 +115,8 @@ static bool servicing(void *data, stream_t *stream)
|
|||||||
switch (nr++)
|
switch (nr++)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
snprintf(hdr, sizeof(hdr), "%s %s HTTP/1.%u",
|
snprintf(hdr, sizeof(hdr), "%s %s HTTP/1.1",
|
||||||
test->meth, test->path, test->minor);
|
test->meth, test->path);
|
||||||
ck_assert_str_eq(hdr, start);
|
ck_assert_str_eq(hdr, start);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -158,7 +156,7 @@ static bool servicing(void *data, stream_t *stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* response headers */
|
/* 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)));
|
ck_assert(stream->write_all(stream, buf, strlen(buf)));
|
||||||
|
|
||||||
/* if the response code indicates an error the following write operations
|
/* 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[] = {
|
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 },
|
NULL, 0, "\x12\x34", 2, 0 },
|
||||||
{ "GET", 0, "localhost", 6543, "/", NULL,
|
{ "GET", "localhost", 6543, "/", NULL,
|
||||||
NULL, 0, NULL, 0, 0 },
|
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 },
|
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 },
|
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",
|
snprintf(uri, sizeof(uri), "http://%s:%u%s",
|
||||||
gtests[_i].host, gtests[_i].port, gtests[_i].path);
|
gtests[_i].host, gtests[_i].port, gtests[_i].path);
|
||||||
status = lib->fetcher->fetch(lib->fetcher, uri, &data,
|
status = lib->fetcher->fetch(lib->fetcher, uri, &data, FETCH_END);
|
||||||
!gtests[_i].minor ? FETCH_HTTP_VERSION_1_0 : FETCH_END,
|
|
||||||
FETCH_END);
|
|
||||||
ck_assert_int_eq(status, SUCCESS);
|
ck_assert_int_eq(status, SUCCESS);
|
||||||
expected = chunk_create(gtests[_i].res, gtests[_i].res_len);
|
expected = chunk_create(gtests[_i].res, gtests[_i].res_len);
|
||||||
ck_assert_msg(chunk_compare(expected, data) == 0,
|
ck_assert_msg(chunk_compare(expected, data) == 0,
|
||||||
@@ -229,11 +225,11 @@ END_TEST
|
|||||||
|
|
||||||
|
|
||||||
static test_service_t ptests[] = {
|
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 },
|
"\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 },
|
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 },
|
"\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_TYPE, ptests[_i].type,
|
||||||
FETCH_REQUEST_DATA,
|
FETCH_REQUEST_DATA,
|
||||||
chunk_create(ptests[_i].req, ptests[_i].req_len),
|
chunk_create(ptests[_i].req, ptests[_i].req_len),
|
||||||
!ptests[_i].minor ? FETCH_HTTP_VERSION_1_0 : FETCH_END,
|
|
||||||
FETCH_END);
|
FETCH_END);
|
||||||
ck_assert_int_eq(status, SUCCESS);
|
ck_assert_int_eq(status, SUCCESS);
|
||||||
expected = chunk_create(ptests[_i].res, ptests[_i].res_len);
|
expected = chunk_create(ptests[_i].res, ptests[_i].res_len);
|
||||||
@@ -271,11 +266,11 @@ END_TEST
|
|||||||
|
|
||||||
|
|
||||||
static test_service_t rtests[] = {
|
static test_service_t rtests[] = {
|
||||||
{ "GET", 1, "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 200 },
|
{ "GET", "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 200 },
|
||||||
{ "GET", 1, "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 204 },
|
{ "GET", "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 204 },
|
||||||
{ "GET", 1, "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 400 },
|
{ "GET", "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 400 },
|
||||||
{ "GET", 1, "localhost", 6544, "/", NULL, NULL, 0, NULL, 0, 404 },
|
{ "GET", "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, 500 },
|
||||||
};
|
};
|
||||||
|
|
||||||
START_TEST(test_response_code)
|
START_TEST(test_response_code)
|
||||||
|
|||||||
Reference in New Issue
Block a user