testipsub.c (apr-1.6.5.tar.bz2) | : | testipsub.c (apr-1.7.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 176 | skipping to change at line 176 | |||
} | } | |||
static void test_parse_addr_port(abts_case *tc, void *data) | static void test_parse_addr_port(abts_case *tc, void *data) | |||
{ | { | |||
const struct { | const struct { | |||
const char *input; | const char *input; | |||
apr_status_t rv; | apr_status_t rv; | |||
const char *addr, *scope_id; | const char *addr, *scope_id; | |||
apr_port_t port; | apr_port_t port; | |||
} *test, testcases[] = { | } *test, testcases[] = { | |||
/* Success cases */ | ||||
{ "localhost:80", APR_SUCCESS, "localhost", NULL, 80 } | { "localhost:80", APR_SUCCESS, "localhost", NULL, 80 } | |||
,{ "localhost", APR_SUCCESS, "localhost", NULL, 0 } | ||||
,{ "www.example.com:8080", APR_SUCCESS, "www.example.com", NULL, 8080 } | ,{ "www.example.com:8080", APR_SUCCESS, "www.example.com", NULL, 8080 } | |||
,{ "w:1", APR_SUCCESS, "w", NULL, 1 } | ,{ "w:1", APR_SUCCESS, "w", NULL, 1 } | |||
,{ "127.0.0.1:80", APR_SUCCESS, "127.0.0.1", NULL, 80 } | ,{ "127.0.0.1:80", APR_SUCCESS, "127.0.0.1", NULL, 80 } | |||
,{ "8080", APR_SUCCESS, NULL, NULL, 8080 } /* API doc has this case */ | ||||
#if APR_HAVE_IPV6 | ||||
,{ "[::]:80", APR_SUCCESS, "::", NULL, 80 } | ,{ "[::]:80", APR_SUCCESS, "::", NULL, 80 } | |||
,{ "[::%eth0]:80", APR_SUCCESS, "::", "eth0", 80 } | ||||
,{ "[::%eth0]", APR_SUCCESS, "::", "eth0", 0 } | ||||
#endif | ||||
/* Failure cases */ | ||||
,{ "localhost:999999", APR_EINVAL, NULL, NULL, 0 } | ,{ "localhost:999999", APR_EINVAL, NULL, NULL, 0 } | |||
,{ "localhost:0", APR_EINVAL, NULL, NULL, 0 } | ,{ "localhost:0", APR_EINVAL, NULL, NULL, 0 } | |||
#if APR_HAVE_IPV6 | ||||
,{ "[abc]", APR_EINVAL, NULL, NULL, 0 } | ||||
,{ "[::]z:80", APR_EINVAL, NULL, NULL, 0 } | ,{ "[::]z:80", APR_EINVAL, NULL, NULL, 0 } | |||
,{ "[:::80", APR_EINVAL, NULL, NULL, 0 } | ,{ "[:::80", APR_EINVAL, NULL, NULL, 0 } | |||
,{ "[zzzz]:80", APR_EINVAL, NULL, NULL, 0 } | ,{ "[zzzz]:80", APR_EINVAL, NULL, NULL, 0 } | |||
,{ "[::%]:80", APR_EINVAL, NULL, NULL, 0 } | ,{ "[::%]:80", APR_EINVAL, NULL, NULL, 0 } | |||
,{ "[::%eth0]:80", APR_SUCCESS, "::", "eth0", 80 } | #endif | |||
/* ,{ "127.0.0.1:80x", APR_EINVAL, NULL, NULL, 0 } <- should fail, doesn 't */ | /* ,{ "127.0.0.1:80x", APR_EINVAL, NULL, NULL, 0 } <- should fail, doesn 't */ | |||
/* ,{ "127.0.0.1x:80", APR_EINVAL, NULL, NULL, 0 } <- maybe should fail? , doesn't */ | /* ,{ "127.0.0.1x:80", APR_EINVAL, NULL, NULL, 0 } <- maybe should fail? , doesn't */ | |||
/* ,{ "localhost:-1", APR_EINVAL, NULL, NULL, 0 } <- should fail, doesn 't */ | /* ,{ "localhost:-1", APR_EINVAL, NULL, NULL, 0 } <- should fail, doesn 't */ | |||
}; | }; | |||
unsigned i; | unsigned i; | |||
for (i = 0; i < (sizeof testcases / sizeof testcases[0]); i++) { | for (i = 0; i < (sizeof testcases / sizeof testcases[0]); i++) { | |||
char *addr, *scope_id; | char *addr, *scope_id; | |||
apr_port_t port; | apr_port_t port; | |||
apr_status_t rv; | apr_status_t rv; | |||
End of changes. 6 change blocks. | ||||
1 lines changed or deleted | 12 lines changed or added |