Skip to content

Commit

Permalink
Test all splits
Browse files Browse the repository at this point in the history
  • Loading branch information
detecteamgit committed Dec 10, 2024
1 parent f8ed042 commit 28c08d0
Showing 1 changed file with 51 additions and 6 deletions.
57 changes: 51 additions & 6 deletions src/tests/urlsplit.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,57 @@ int main(int argc, char **argv)
pos = faup_get_scheme_pos(fh);
size = faup_get_scheme_size(fh);
if (size > 0) {
char *out = malloc(size + 1);
memset(out, '\0', size+1);
memcpy(out, instr, size);

printf("The decoded scheme is '%s'\n", out);
free(out);
printf("scheme:%.*s\n", (int)size, instr + pos);
}
pos = faup_get_credential_pos(fh);
size = faup_get_credential_size(fh);
if (size > 0) {
printf("credential:%.*s\n", (int)size, instr + pos);
}
pos = faup_get_subdomain_pos(fh);
size = faup_get_subdomain_size(fh);
if (size > 0) {
printf("subdomain:%.*s\n", (int)size, instr + pos);
}
pos = faup_get_domain_pos(fh);
size = faup_get_domain_size(fh);
if (size > 0) {
printf("domain:%.*s\n", (int)size, instr + pos);
}
pos = faup_get_domain_without_tld_pos(fh);
size = faup_get_domain_without_tld_size(fh);
if (size > 0) {
printf("domain without tld:%.*s\n", (int)size, instr + pos);
}
pos = faup_get_host_pos(fh);
size = faup_get_host_size(fh);
if (size > 0) {
printf("host:%.*s\n", (int)size, instr + pos);
}
pos = faup_get_tld_pos(fh);
size = faup_get_tld_size(fh);
if (size > 0) {
printf("tld:%.*s\n", (int)size, instr + pos);
}
pos = faup_get_port_pos(fh);
size = faup_get_port_size(fh);
if (size > 0) {
printf("port:%.*s\n", (int)size, instr + pos);
}
pos = faup_get_resource_path_pos(fh);
size = faup_get_resource_path_size(fh);
if (size > 0) {
printf("resource path:%.*s\n", (int)size, instr + pos);
}
pos = faup_get_query_string_pos(fh);
size = faup_get_query_string_size(fh);
if (size > 0) {
printf("query string:%.*s\n", (int)size, instr + pos);
}
pos = faup_get_fragment_pos(fh);
size = faup_get_fragment_size(fh);
if (size > 0) {
printf("fragment:%.*s\n", (int)size, instr + pos);
}

faup_terminate(fh);
Expand Down

0 comments on commit 28c08d0

Please sign in to comment.