diff options
author | lexborisov <lex.borisov@gmail.com> | 2017-03-01 16:07:21 +0300 |
---|---|---|
committer | lexborisov <lex.borisov@gmail.com> | 2017-03-01 16:07:21 +0300 |
commit | fa45cd70e56b495b7413ce62ab352e98b6516e9b (patch) | |
tree | c2ab346c87b4e31c06e5905e4f298bcf950ac1ac /utils | |
parent | c0ca7ee5619db879c8cb29ab7a1ec64528d2d4bf (diff) |
URL parsing by specification https://url.spec.whatwg.org/
Diffstat (limited to 'utils')
-rw-r--r-- | utils/MyHTML/url_resources.pl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/MyHTML/url_resources.pl b/utils/MyHTML/url_resources.pl index 6998c43..2562fef 100644 --- a/utils/MyHTML/url_resources.pl +++ b/utils/MyHTML/url_resources.pl @@ -62,6 +62,7 @@ my $utils_data = $utils->read_tmpl("url_resources.h"); $utils->save_src("resources.h", $utils_data, { BODY => + get_text_data(creare_for_query(), "myhtml_url_resources_static_map_query_charset") . get_text_data(creare_for_forbidden_host_code_point(), "myhtml_url_resources_static_map_forbidden_host_code_point") . "/* A C0 control is a code point in the range U+0000 to U+001F, inclusive. The C0 control percent-encode set are C0 controls and all code points greater than U+007E. */\n". get_text_data(creare_for_simple(), "myhtml_url_resources_static_map_C0") . @@ -72,6 +73,26 @@ $utils->save_src("resources.h", $utils_data, } ); +sub creare_for_query { + my @data; + + for my $codepoint (0..255) { + my $char = chr($codepoint); + + # less than 0x21, greater than 0x7E, or is 0x22, 0x23, 0x3C, or 0x3E + if ($codepoint < 33 || $codepoint > 126 || $codepoint == 0x22 || + $codepoint == 0x23 || $codepoint == 0x3C || $codepoint == 0x3E) + { + push @data, "0x00"; + } + else { + push @data, sprintf("0x%02x", $codepoint); + } + } + + return \@data; +} + sub creare_for_forbidden_host_code_point { my @data; |