line |
true |
false |
branch |
26
|
0 |
0 |
for (c = str; *c; c++) { |
27
|
0 |
0 |
if (*c == ':' && *(c+1) == '/' && *(c+2) == '/') |
|
0 |
0 |
if (*c == ':' && *(c+1) == '/' && *(c+2) == '/') |
|
0 |
0 |
if (*c == ':' && *(c+1) == '/' && *(c+2) == '/') |
30
|
0 |
0 |
if ((*c < 'a' || *c > 'z') && |
|
0 |
0 |
if ((*c < 'a' || *c > 'z') && |
|
0 |
0 |
if ((*c < 'a' || *c > 'z') && |
31
|
0 |
0 |
(*c < 'A' || *c > 'Z') && |
|
0 |
0 |
(*c < 'A' || *c > 'Z') && |
32
|
0 |
0 |
(*c < '0' || *c > '9') && |
|
0 |
0 |
(*c < '0' || *c > '9') && |
33
|
0 |
0 |
(*c != '+' && *c != '-' && *c != '.')) |
|
0 |
0 |
(*c != '+' && *c != '-' && *c != '.')) |
42
|
0 |
0 |
if (strcmp(scheme, "http") == 0) |
44
|
0 |
0 |
else if (strcmp(scheme, "https") == 0) |
46
|
0 |
0 |
else if (strcmp(scheme, "git") == 0) |
48
|
0 |
0 |
else if (strcmp(scheme, "ssh") == 0 || |
|
0 |
0 |
else if (strcmp(scheme, "ssh") == 0 || |
49
|
0 |
0 |
strcmp(scheme, "ssh+git") == 0 || |
58
|
0 |
0 |
if (in->scheme) { |
60
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->scheme); |
63
|
0 |
0 |
if (in->host) { |
65
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->host); |
68
|
0 |
0 |
if (in->port) { |
70
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->port); |
73
|
0 |
0 |
if (in->path) { |
75
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->path); |
78
|
0 |
0 |
if (in->query) { |
80
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->query); |
83
|
0 |
0 |
if (in->username) { |
85
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->username); |
88
|
0 |
0 |
if (in->password) { |
90
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->password); |
109
|
0 |
0 |
if (http_parser_parse_url(given, strlen(given), false, &u)) { |
121
|
0 |
0 |
if (has_scheme) { |
131
|
0 |
0 |
if (has_host) { |
137
|
0 |
0 |
if (has_port) { |
144
|
0 |
0 |
if (default_port == NULL) { |
152
|
0 |
0 |
if (has_path) { |
160
|
0 |
0 |
if (has_query) { |
166
|
0 |
0 |
if (has_userinfo) { |
171
|
0 |
0 |
if (colon) { |
185
|
0 |
0 |
git_str_oom(&host) || |
186
|
0 |
0 |
git_str_oom(&port) || |
187
|
0 |
0 |
git_str_oom(&path) || |
188
|
0 |
0 |
git_str_oom(&query) || |
189
|
0 |
0 |
git_str_oom(&username) || |
225
|
0 |
0 |
if (*str++ != '[') |
228
|
0 |
0 |
for (c = str; *c; c++) { |
229
|
0 |
0 |
if (*c == ':') |
232
|
0 |
0 |
if (*c == ']') |
235
|
0 |
0 |
if (*c != ':' && |
|
0 |
0 |
if (*c != ':' && |
236
|
0 |
0 |
(*c < '0' || *c > '9') && |
|
0 |
0 |
(*c < '0' || *c > '9') && |
237
|
0 |
0 |
(*c < 'a' || *c > 'f') && |
|
0 |
0 |
(*c < 'a' || *c > 'f') && |
238
|
0 |
0 |
(*c < 'A' || *c > 'F')) |
249
|
0 |
0 |
for (c = str; *c; c++) { |
250
|
0 |
0 |
if (*c == '@') |
253
|
0 |
0 |
if (*c == ':') |
278
|
0 |
0 |
for (c = given; *c && !path; c++) { |
|
0 |
0 |
for (c = given; *c && !path; c++) { |
287
|
0 |
0 |
if (is_ipv6(c)) { |
290
|
0 |
0 |
} else if (bracket++ > 1) { |
295
|
0 |
0 |
if (has_at(c)) { |
307
|
0 |
0 |
if (*c == '@') { |
314
|
0 |
0 |
state = (*c == '[') ? IPV6 : HOST; |
319
|
0 |
0 |
if (*c == ':') { |
321
|
0 |
0 |
state = bracket ? PORT_START : PATH_START; |
322
|
0 |
0 |
} else if (*c == ']') { |
323
|
0 |
0 |
if (bracket-- == 0) |
332
|
0 |
0 |
if (*c != ':') |
338
|
0 |
0 |
if (*c == ']') |
343
|
0 |
0 |
if (*c != ':') |
347
|
0 |
0 |
state = bracket ? PORT_START : PATH_START; |
356
|
0 |
0 |
if (*c == ']') { |
357
|
0 |
0 |
if (bracket-- == 0) |
366
|
0 |
0 |
if (*c != ':') |
381
|
0 |
0 |
if (!path) |
384
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(url->scheme = git__strdup("ssh")); |
386
|
0 |
0 |
if (user_len) |
387
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(url->username = git__strndup(user, user_len)); |
389
|
0 |
0 |
GIT_ASSERT(host_len); |
390
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(url->host = git__strndup(host, host_len)); |
392
|
0 |
0 |
if (port_len) |
393
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(url->port = git__strndup(port, port_len)); |
395
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(url->port = git__strdup(default_port)); |
397
|
0 |
0 |
GIT_ASSERT(path); |
398
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(url->path = git__strdup(path)); |
414
|
0 |
0 |
if ((query = strchr(two, '?')) != NULL) { |
417
|
0 |
0 |
if (*(++query) != '\0') { |
419
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->query); |
426
|
0 |
0 |
one_len = one->path ? strlen(one->path) : 0; |
427
|
0 |
0 |
while (one_len && one->path[one_len - 1] == '/') |
|
0 |
0 |
while (one_len && one->path[one_len - 1] == '/') |
431
|
0 |
0 |
while (*two == '/') { |
440
|
0 |
0 |
if (git_str_oom(&path)) |
445
|
0 |
0 |
if (one->scheme) { |
447
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->scheme); |
450
|
0 |
0 |
if (one->host) { |
452
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->host); |
455
|
0 |
0 |
if (one->port) { |
457
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->port); |
460
|
0 |
0 |
if (one->username) { |
462
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->username); |
465
|
0 |
0 |
if (one->password) { |
467
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(out->password); |
486
|
0 |
0 |
(size_t)(service_query - service_suffix) : full_suffix_len; |
494
|
0 |
0 |
if (suffix_len && path_len >= suffix_len) { |
|
0 |
0 |
if (suffix_len && path_len >= suffix_len) { |
497
|
0 |
0 |
if (git__strncmp(url->path + suffix_offset, service_suffix, suffix_len) == 0 && |
|
0 |
0 |
if (git__strncmp(url->path + suffix_offset, service_suffix, suffix_len) == 0 && |
498
|
0 |
0 |
(!service_query || git__strcmp(url->query, service_query + 1) == 0)) { |
508
|
0 |
0 |
if (truncate < 0 && git__suffixcmp(url->path, service_suffix) == 0) |
|
0 |
0 |
if (truncate < 0 && git__suffixcmp(url->path, service_suffix) == 0) |
512
|
0 |
0 |
if (truncate == 0) |
515
|
0 |
0 |
if (truncate > 0) { |
532
|
0 |
0 |
GIT_ASSERT(url); |
533
|
0 |
0 |
GIT_ASSERT(redirect_location); |
535
|
0 |
0 |
if (redirect_location[0] == '/') { |
538
|
0 |
0 |
if ((url->path = git__strdup(redirect_location)) == NULL) { |
545
|
0 |
0 |
if ((error = git_net_url_parse(&tmp, redirect_location)) < 0) |
550
|
0 |
0 |
if (original->scheme && |
|
0 |
0 |
if (original->scheme && |
551
|
0 |
0 |
strcmp(original->scheme, tmp.scheme) != 0 && |
560
|
0 |
0 |
if (original->host && |
|
0 |
0 |
if (original->host && |
561
|
0 |
0 |
!allow_offsite && |
574
|
0 |
0 |
if (service_suffix) |
584
|
0 |
0 |
return (url->host && url->port && url->path); |
|
0 |
0 |
return (url->host && url->port && url->path); |
|
0 |
0 |
return (url->host && url->port && url->path); |
591
|
0 |
0 |
if ((default_port = default_port_for_scheme(url->scheme)) != NULL) |
613
|
0 |
0 |
GIT_ASSERT_ARG(url); |
614
|
0 |
0 |
GIT_ASSERT_ARG(url->scheme); |
615
|
0 |
0 |
GIT_ASSERT_ARG(url->host); |
620
|
0 |
0 |
if (url->username) { |
623
|
0 |
0 |
if (url->password) { |
633
|
0 |
0 |
if (url->port && !git_net_url_is_default_port(url)) { |
|
0 |
0 |
if (url->port && !git_net_url_is_default_port(url)) { |
638
|
0 |
0 |
git_str_puts(buf, url->path ? url->path : "/"); |
640
|
0 |
0 |
if (url->query) { |
645
|
0 |
0 |
return git_str_oom(buf) ? -1 : 0; |
650
|
0 |
0 |
git_str_puts(buf, url->path ? url->path : "/"); |
652
|
0 |
0 |
if (url->query) { |
657
|
0 |
0 |
return git_str_oom(buf) ? -1 : 0; |
671
|
0 |
0 |
if (!pattern_len) |
673
|
0 |
0 |
else if (pattern_len == 1 && pattern[0] == '*') |
|
0 |
0 |
else if (pattern_len == 1 && pattern[0] == '*') |
675
|
0 |
0 |
else if (pattern_len > 1 && pattern[0] == '*' && pattern[1] == '.') |
|
0 |
0 |
else if (pattern_len > 1 && pattern[0] == '*' && pattern[1] == '.') |
|
0 |
0 |
else if (pattern_len > 1 && pattern[0] == '*' && pattern[1] == '.') |
677
|
0 |
0 |
else if (pattern[0] == '.') |
683
|
0 |
0 |
if ((colon = memchr(domain, ':', domain_len)) != NULL) { |
690
|
0 |
0 |
if (port_len && git__strlcmp(url->port, port, port_len) != 0) |
|
0 |
0 |
if (port_len && git__strlcmp(url->port, port, port_len) != 0) |
694
|
0 |
0 |
if (!wildcard) |
698
|
0 |
0 |
if ((host_len = strlen(url->host)) < domain_len || |
|
0 |
0 |
if ((host_len = strlen(url->host)) < domain_len || |
703
|
0 |
0 |
if (host_len == domain_len) |
721
|
0 |
0 |
for (pattern = pattern_list; |
722
|
0 |
0 |
pattern && *pattern; |
723
|
0 |
0 |
pattern = sep ? sep + 1 : NULL) { |
725
|
0 |
0 |
pattern_end = sep ? sep : strchr(pattern, '\0'); |
727
|
0 |
0 |
if (matches_pattern(url, pattern, (pattern_end - pattern))) |
736
|
0 |
0 |
if (url->username) |
739
|
0 |
0 |
if (url->password) |