@@ -19,10 +19,10 @@ namespace ada::checkers {
1919 }
2020
2121
22- // for use with path_signature
22+ // for use with path_signature, we include all characters that need percent encoding.
2323 static constexpr uint8_t path_signature_table[256 ] = {
2424 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
25- 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 1 , 0 , 8 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , 0 ,
25+ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 1 , 1 , 0 , 8 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , 0 ,
2626 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
2727 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , 0 , 0 , 0 ,
2828 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
@@ -32,8 +32,28 @@ namespace ada::checkers {
3232 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
3333 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
3434 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 };
35+ static_assert (path_signature_table[uint8_t (' ?' )] == 1 );
36+ static_assert (path_signature_table[uint8_t (' `' )] == 1 );
37+ static_assert (path_signature_table[uint8_t (' {' )] == 1 );
38+ static_assert (path_signature_table[uint8_t (' }' )] == 1 );
39+ //
40+ static_assert (path_signature_table[uint8_t (' ' )] == 1 );
41+ static_assert (path_signature_table[uint8_t (' ?' )] == 1 );
42+ static_assert (path_signature_table[uint8_t (' "' )] == 1 );
43+ static_assert (path_signature_table[uint8_t (' #' )] == 1 );
44+ static_assert (path_signature_table[uint8_t (' <' )] == 1 );
45+ static_assert (path_signature_table[uint8_t (' >' )] == 1 );
46+ //
47+ static_assert (path_signature_table[0 ] == 1 );
48+ static_assert (path_signature_table[31 ] == 1 );
49+ static_assert (path_signature_table[127 ] == 1 );
50+ static_assert (path_signature_table[128 ] == 1 );
51+ static_assert (path_signature_table[255 ] == 1 );
3552
3653 ada_really_inline constexpr uint8_t path_signature (std::string_view input) noexcept {
54+ // The path percent-encode set is the query percent-encode set and U+003F (?), U+0060 (`), U+007B ({), and U+007D (}).
55+ // The query percent-encode set is the C0 control percent-encode set and U+0020 SPACE, U+0022 ("), U+0023 (#), U+003C (<), and U+003E (>).
56+ // The C0 control percent-encode set are the C0 controls and all code points greater than U+007E (~).
3757 size_t i = 0 ;
3858 uint8_t accumulator{};
3959 for (; i + 7 < input.size (); i += 8 ) {
0 commit comments