typedef struct {
/* HTTP Method */
char *meth;
- /* HTTP 1.x minor version */
- int minor;
/* host to connect to */
char *host;
/* HTTP service port */
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:
}
/* 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
}
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 },
};
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,
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 },
};
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);
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)