| ... | @@ -1050,7 +1050,7 @@ fn parseHost(allocator: std.mem.Allocator, input: []u8, isOpaque: bool) !URL.Hos | ... | @@ -1050,7 +1050,7 @@ fn parseHost(allocator: std.mem.Allocator, input: []u8, isOpaque: bool) !URL.Hos |
| 1050 | } | 1050 | } |
| 1051 | | 1051 | |
| 1052 | /// https://url.spec.whatwg.org/#concept-ipv6-parser | 1052 | /// https://url.spec.whatwg.org/#concept-ipv6-parser |
| 1053 | fn parseIPv6(input: []const u8) !u128 { | 1053 | pub fn parseIPv6(input: []const u8) !u128 { |
| 1054 | // 1. Let address be a new IPv6 address whose pieces are all 0. | 1054 | // 1. Let address be a new IPv6 address whose pieces are all 0. |
| 1055 | var address: [8]u16 = @splat(0); | 1055 | var address: [8]u16 = @splat(0); |
| 1056 | _ = &address; | 1056 | _ = &address; |
| ... | @@ -1286,7 +1286,7 @@ fn endsInANumber(input: []const u8) bool { | ... | @@ -1286,7 +1286,7 @@ fn endsInANumber(input: []const u8) bool { |
| 1286 | } | 1286 | } |
| 1287 | | 1287 | |
| 1288 | /// https://url.spec.whatwg.org/#concept-ipv4-parser | 1288 | /// https://url.spec.whatwg.org/#concept-ipv4-parser |
| 1289 | fn parseIPv4(input: []const u8) !u32 { | 1289 | pub fn parseIPv4(input: []const u8) !u32 { |
| 1290 | // 1. Let parts be the result of strictly splitting input on U+002E (.). | 1290 | // 1. Let parts be the result of strictly splitting input on U+002E (.). |
| 1291 | var end = input.len; | 1291 | var end = input.len; |
| 1292 | var parts_size = extras.countScalar(u8, input[0..end], '.') + 1; | 1292 | var parts_size = extras.countScalar(u8, input[0..end], '.') + 1; |
| ... | @@ -1405,18 +1405,18 @@ fn shortenUrlPath(url: *ManyArrayList(15, u8), has_opaque_path: bool) void { | ... | @@ -1405,18 +1405,18 @@ fn shortenUrlPath(url: *ManyArrayList(15, u8), has_opaque_path: bool) void { |
| 1405 | // | 1405 | // |
| 1406 | | 1406 | |
| 1407 | /// https://infra.spec.whatwg.org/#c0-control | 1407 | /// https://infra.spec.whatwg.org/#c0-control |
| 1408 | fn is_c0control(c: u8) bool { | 1408 | pub fn is_c0control(c: u8) bool { |
| 1409 | if (c >= 0x00 and c <= 0x1F) return true; | 1409 | if (c >= 0x00 and c <= 0x1F) return true; |
| 1410 | return false; | 1410 | return false; |
| 1411 | } | 1411 | } |
| 1412 | /// https://infra.spec.whatwg.org/#c0-control-or-space | 1412 | /// https://infra.spec.whatwg.org/#c0-control-or-space |
| 1413 | fn is_c0control_or_space(c: u8) bool { | 1413 | pub fn is_c0control_or_space(c: u8) bool { |
| 1414 | if (is_c0control(c)) return true; | 1414 | if (is_c0control(c)) return true; |
| 1415 | if (c == ' ') return true; | 1415 | if (c == ' ') return true; |
| 1416 | return false; | 1416 | return false; |
| 1417 | } | 1417 | } |
| 1418 | /// https://url.spec.whatwg.org/#forbidden-host-code-point | 1418 | /// https://url.spec.whatwg.org/#forbidden-host-code-point |
| 1419 | fn is_forbidden_host_codepoint(c: u8) bool { | 1419 | pub fn is_forbidden_host_codepoint(c: u8) bool { |
| 1420 | if (c == 0) return true; | 1420 | if (c == 0) return true; |
| 1421 | if (c == '\t') return true; | 1421 | if (c == '\t') return true; |
| 1422 | if (c == '\n') return true; | 1422 | if (c == '\n') return true; |
| ... | @@ -1437,7 +1437,7 @@ fn is_forbidden_host_codepoint(c: u8) bool { | ... | @@ -1437,7 +1437,7 @@ fn is_forbidden_host_codepoint(c: u8) bool { |
| 1437 | return false; | 1437 | return false; |
| 1438 | } | 1438 | } |
| 1439 | /// https://url.spec.whatwg.org/#forbidden-domain-code-point | 1439 | /// https://url.spec.whatwg.org/#forbidden-domain-code-point |
| 1440 | fn is_forbidden_domain_codepoint(c: u8) bool { | 1440 | pub fn is_forbidden_domain_codepoint(c: u8) bool { |
| 1441 | if (is_forbidden_host_codepoint(c)) return true; | 1441 | if (is_forbidden_host_codepoint(c)) return true; |
| 1442 | if (is_c0control(c)) return true; | 1442 | if (is_c0control(c)) return true; |
| 1443 | if (c == '%') return true; | 1443 | if (c == '%') return true; |
| ... | @@ -1445,7 +1445,7 @@ fn is_forbidden_domain_codepoint(c: u8) bool { | ... | @@ -1445,7 +1445,7 @@ fn is_forbidden_domain_codepoint(c: u8) bool { |
| 1445 | return false; | 1445 | return false; |
| 1446 | } | 1446 | } |
| 1447 | /// https://url.spec.whatwg.org/#url-code-points | 1447 | /// https://url.spec.whatwg.org/#url-code-points |
| 1448 | fn is_url_codepoint(c: u21) bool { | 1448 | pub fn is_url_codepoint(c: u21) bool { |
| 1449 | if (c < 128 and std.ascii.isAlphanumeric(@intCast(c))) return true; | 1449 | if (c < 128 and std.ascii.isAlphanumeric(@intCast(c))) return true; |
| 1450 | if (c == '!') return true; | 1450 | if (c == '!') return true; |
| 1451 | if (c == '$') return true; | 1451 | if (c == '$') return true; |
| ... | @@ -1472,12 +1472,12 @@ fn is_url_codepoint(c: u21) bool { | ... | @@ -1472,12 +1472,12 @@ fn is_url_codepoint(c: u21) bool { |
| 1472 | return false; | 1472 | return false; |
| 1473 | } | 1473 | } |
| 1474 | /// https://url.spec.whatwg.org/#c0-control-percent-encode-set | 1474 | /// https://url.spec.whatwg.org/#c0-control-percent-encode-set |
| 1475 | fn is_c0control_percent_char(c: u8) bool { | 1475 | pub fn is_c0control_percent_char(c: u8) bool { |
| 1476 | if (c >= 0x00 and c <= 0x1F) return true; | 1476 | if (c >= 0x00 and c <= 0x1F) return true; |
| 1477 | return c > 0x7E; | 1477 | return c > 0x7E; |
| 1478 | } | 1478 | } |
| 1479 | /// https://url.spec.whatwg.org/#query-percent-encode-set | 1479 | /// https://url.spec.whatwg.org/#query-percent-encode-set |
| 1480 | fn is_query_percent_char(c: u8) bool { | 1480 | pub fn is_query_percent_char(c: u8) bool { |
| 1481 | if (c == ' ') return true; | 1481 | if (c == ' ') return true; |
| 1482 | if (c == '"') return true; | 1482 | if (c == '"') return true; |
| 1483 | if (c == '#') return true; | 1483 | if (c == '#') return true; |
| ... | @@ -1486,7 +1486,7 @@ fn is_query_percent_char(c: u8) bool { | ... | @@ -1486,7 +1486,7 @@ fn is_query_percent_char(c: u8) bool { |
| 1486 | return is_c0control_percent_char(c); | 1486 | return is_c0control_percent_char(c); |
| 1487 | } | 1487 | } |
| 1488 | /// https://url.spec.whatwg.org/#path-percent-encode-set | 1488 | /// https://url.spec.whatwg.org/#path-percent-encode-set |
| 1489 | fn is_path_percent_char(c: u8) bool { | 1489 | pub fn is_path_percent_char(c: u8) bool { |
| 1490 | if (c == '?') return true; | 1490 | if (c == '?') return true; |
| 1491 | if (c == '^') return true; | 1491 | if (c == '^') return true; |
| 1492 | if (c == '`') return true; | 1492 | if (c == '`') return true; |
| ... | @@ -1495,12 +1495,12 @@ fn is_path_percent_char(c: u8) bool { | ... | @@ -1495,12 +1495,12 @@ fn is_path_percent_char(c: u8) bool { |
| 1495 | return is_query_percent_char(c); | 1495 | return is_query_percent_char(c); |
| 1496 | } | 1496 | } |
| 1497 | /// https://url.spec.whatwg.org/#special-query-percent-encode-set | 1497 | /// https://url.spec.whatwg.org/#special-query-percent-encode-set |
| 1498 | fn is_special_query_percent_char(c: u8) bool { | 1498 | pub fn is_special_query_percent_char(c: u8) bool { |
| 1499 | if (c == '\'') return true; | 1499 | if (c == '\'') return true; |
| 1500 | return is_query_percent_char(c); | 1500 | return is_query_percent_char(c); |
| 1501 | } | 1501 | } |
| 1502 | /// https://url.spec.whatwg.org/#fragment-percent-encode-set | 1502 | /// https://url.spec.whatwg.org/#fragment-percent-encode-set |
| 1503 | fn is_fragment_percent_char(c: u8) bool { | 1503 | pub fn is_fragment_percent_char(c: u8) bool { |
| 1504 | if (c == ' ') return true; | 1504 | if (c == ' ') return true; |
| 1505 | if (c == '"') return true; | 1505 | if (c == '"') return true; |
| 1506 | if (c == '<') return true; | 1506 | if (c == '<') return true; |
| ... | @@ -1509,7 +1509,7 @@ fn is_fragment_percent_char(c: u8) bool { | ... | @@ -1509,7 +1509,7 @@ fn is_fragment_percent_char(c: u8) bool { |
| 1509 | return is_c0control_percent_char(c); | 1509 | return is_c0control_percent_char(c); |
| 1510 | } | 1510 | } |
| 1511 | /// https://url.spec.whatwg.org/#userinfo-percent-encode-set | 1511 | /// https://url.spec.whatwg.org/#userinfo-percent-encode-set |
| 1512 | fn is_userinfo_percent_char(c: u8) bool { | 1512 | pub fn is_userinfo_percent_char(c: u8) bool { |
| 1513 | if (c == '/') return true; | 1513 | if (c == '/') return true; |
| 1514 | if (c == ':') return true; | 1514 | if (c == ':') return true; |
| 1515 | if (c == ';') return true; | 1515 | if (c == ';') return true; |