-
-
-
319 std::array<uint8_t, 256>
result{};
-
320 for (
int i : {
':',
'/',
'[',
'\\',
'?'}) {
-
-
-
-
+
+
+
+
+
+
+
+
+
186#ifndef ada_make_uint8x16_t
+
187#define ada_make_uint8x16_t(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, \
+
188 x13, x14, x15, x16) \
+
+
190 static uint8_t array[16] = {x1, x2, x3, x4, x5, x6, x7, x8, \
+
191 x9, x10, x11, x12, x13, x14, x15, x16}; \
+
192 return vld1q_u8(array); \
+
+
+
+
+
197 std::string_view view,
size_t location)
noexcept {
+
+
199 if (view.size() - location < 16) {
+
200 for (
size_t i = location; i < view.size(); i++) {
+
201 if (view[i] ==
':' || view[i] ==
'/' || view[i] ==
'\\' ||
+
202 view[i] ==
'?' || view[i] ==
'[') {
+
+
+
+
206 return size_t(view.size());
+
+
208 auto to_bitmask = [](uint8x16_t input) -> uint16_t {
+
209 uint8x16_t bit_mask =
+
210 ada_make_uint8x16_t(0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x01,
+
211 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80);
+
212 uint8x16_t minput = vandq_u8(input, bit_mask);
+
213 uint8x16_t tmp = vpaddq_u8(minput, minput);
+
214 tmp = vpaddq_u8(tmp, tmp);
+
215 tmp = vpaddq_u8(tmp, tmp);
+
216 return vgetq_lane_u16(vreinterpretq_u16_u8(tmp), 0);
+
+
+
+
+
221 uint8x16_t low_mask =
+
222 ada_make_uint8x16_t(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
223 0x00, 0x01, 0x04, 0x04, 0x00, 0x00, 0x03);
+
224 uint8x16_t high_mask =
+
225 ada_make_uint8x16_t(0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
+
226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
+
227 uint8x16_t fmask = vmovq_n_u8(0xf);
+
+
229 for (; i + 15 < view.size(); i += 16) {
+
230 uint8x16_t word = vld1q_u8((
const uint8_t*)view.data() + i);
+
231 uint8x16_t lowpart = vqtbl1q_u8(low_mask, vandq_u8(word, fmask));
+
232 uint8x16_t highpart = vqtbl1q_u8(high_mask, vshrq_n_u8(word, 4));
+
233 uint8x16_t classify = vandq_u8(lowpart, highpart);
+
234 if (vmaxvq_u32(vreinterpretq_u32_u8(classify)) != 0) {
+
235 uint8x16_t is_zero = vceqq_u8(classify, zero);
+
236 uint16_t is_non_zero = ~to_bitmask(is_zero);
+
+
+
+
+
241 if (i < view.size()) {
+
+
243 vld1q_u8((
const uint8_t*)view.data() + view.length() - 16);
+
244 uint8x16_t lowpart = vqtbl1q_u8(low_mask, vandq_u8(word, fmask));
+
245 uint8x16_t highpart = vqtbl1q_u8(high_mask, vshrq_n_u8(word, 4));
+
246 uint8x16_t classify = vandq_u8(lowpart, highpart);
+
247 if (vmaxvq_u32(vreinterpretq_u32_u8(classify)) != 0) {
+
248 uint8x16_t is_zero = vceqq_u8(classify, zero);
+
249 uint16_t is_non_zero = ~to_bitmask(is_zero);
+
+
+
+
253 return size_t(view.size());
+
+
+
+
257 std::string_view view,
size_t location)
noexcept {
+
+
259 if (view.size() - location < 16) {
+
260 for (
size_t i = location; i < view.size(); i++) {
+
261 if (view[i] ==
':' || view[i] ==
'/' || view[i] ==
'\\' ||
+
262 view[i] ==
'?' || view[i] ==
'[') {
+
+
+
+
266 return size_t(view.size());
+
+
+
+
270 const __m128i mask1 = _mm_set1_epi8(
':');
+
271 const __m128i mask2 = _mm_set1_epi8(
'/');
+
272 const __m128i mask3 = _mm_set1_epi8(
'\\');
+
273 const __m128i mask4 = _mm_set1_epi8(
'?');
+
274 const __m128i mask5 = _mm_set1_epi8(
'[');
+
+
276 for (; i + 15 < view.size(); i += 16) {
+
277 __m128i word = _mm_loadu_si128((
const __m128i*)(view.data() + i));
+
278 __m128i m1 = _mm_cmpeq_epi8(word, mask1);
+
279 __m128i m2 = _mm_cmpeq_epi8(word, mask2);
+
280 __m128i m3 = _mm_cmpeq_epi8(word, mask3);
+
281 __m128i m4 = _mm_cmpeq_epi8(word, mask4);
+
282 __m128i m5 = _mm_cmpeq_epi8(word, mask5);
+
283 __m128i m = _mm_or_si128(
+
284 _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
+
285 int mask = _mm_movemask_epi8(m);
+
+
+
+
+
290 if (i < view.size()) {
+
+
292 _mm_loadu_si128((
const __m128i*)(view.data() + view.length() - 16));
+
293 __m128i m1 = _mm_cmpeq_epi8(word, mask1);
+
294 __m128i m2 = _mm_cmpeq_epi8(word, mask2);
+
295 __m128i m3 = _mm_cmpeq_epi8(word, mask3);
+
296 __m128i m4 = _mm_cmpeq_epi8(word, mask4);
+
297 __m128i m5 = _mm_cmpeq_epi8(word, mask5);
+
298 __m128i m = _mm_or_si128(
+
299 _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m3, m4)), m5);
+
300 int mask = _mm_movemask_epi8(m);
+
+
+
+
+
305 return size_t(view.length());
+
+
+
+
+
+
+
311 std::array<uint8_t, 256>
result{};
+
312 for (
int i : {
':',
'/',
'[',
'\\',
'?'}) {
+
+
+
+
-
-
-
-
327 std::string_view view,
size_t location)
noexcept {
-
328 auto const str = view.substr(location);
-
329 for (
auto pos = str.begin(); pos != str.end(); ++pos) {
-
-
331 return pos - str.begin() + location;
-
-
-
334 return size_t(view.size());
-
+
+
+
+
319 std::string_view view,
size_t location)
noexcept {
+
320 auto const str = view.substr(location);
+
321 for (
auto pos = str.begin(); pos != str.end(); ++pos) {
+
+
323 return pos - str.begin() + location;
+
+
+
326 return size_t(view.size());
+
-
-
-
-
-
-
-
-
343 size_t location)
noexcept {
-
-
345 if (view.size() - location < 16) {
-
346 for (
size_t i = location; i < view.size(); i++) {
-
347 if (view[i] ==
':' || view[i] ==
'/' || view[i] ==
'?' ||
-
-
-
-
-
352 return size_t(view.size());
-
-
354 auto to_bitmask = [](uint8x16_t input) -> uint16_t {
-
355 uint8x16_t bit_mask =
-
356 ada_make_uint8x16_t(0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x01,
-
357 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80);
-
358 uint8x16_t minput = vandq_u8(input, bit_mask);
-
359 uint8x16_t tmp = vpaddq_u8(minput, minput);
-
360 tmp = vpaddq_u8(tmp, tmp);
-
361 tmp = vpaddq_u8(tmp, tmp);
-
362 return vgetq_lane_u16(vreinterpretq_u16_u8(tmp), 0);
-
-
-
-
-
367 uint8x16_t low_mask =
-
368 ada_make_uint8x16_t(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
369 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x03);
-
370 uint8x16_t high_mask =
-
371 ada_make_uint8x16_t(0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
-
372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-
373 uint8x16_t fmask = vmovq_n_u8(0xf);
-
-
375 for (; i + 15 < view.size(); i += 16) {
-
376 uint8x16_t word = vld1q_u8((
const uint8_t*)view.data() + i);
-
377 uint8x16_t lowpart = vqtbl1q_u8(low_mask, vandq_u8(word, fmask));
-
378 uint8x16_t highpart = vqtbl1q_u8(high_mask, vshrq_n_u8(word, 4));
-
379 uint8x16_t classify = vandq_u8(lowpart, highpart);
-
380 if (vmaxvq_u32(vreinterpretq_u32_u8(classify)) != 0) {
-
381 uint8x16_t is_zero = vceqq_u8(classify, zero);
-
382 uint16_t is_non_zero = ~to_bitmask(is_zero);
-
-
-
-
-
387 if (i < view.size()) {
-
-
389 vld1q_u8((
const uint8_t*)view.data() + view.length() - 16);
-
390 uint8x16_t lowpart = vqtbl1q_u8(low_mask, vandq_u8(word, fmask));
-
391 uint8x16_t highpart = vqtbl1q_u8(high_mask, vshrq_n_u8(word, 4));
-
392 uint8x16_t classify = vandq_u8(lowpart, highpart);
-
393 if (vmaxvq_u32(vreinterpretq_u32_u8(classify)) != 0) {
-
394 uint8x16_t is_zero = vceqq_u8(classify, zero);
-
395 uint16_t is_non_zero = ~to_bitmask(is_zero);
-
-
-
-
399 return size_t(view.size());
-
-
-
-
403 size_t location)
noexcept {
-
-
405 if (view.size() - location < 16) {
-
406 for (
size_t i = location; i < view.size(); i++) {
-
407 if (view[i] ==
':' || view[i] ==
'/' || view[i] ==
'?' ||
-
-
-
-
-
412 return size_t(view.size());
-
-
-
-
416 const __m128i mask1 = _mm_set1_epi8(
':');
-
417 const __m128i mask2 = _mm_set1_epi8(
'/');
-
418 const __m128i mask4 = _mm_set1_epi8(
'?');
-
419 const __m128i mask5 = _mm_set1_epi8(
'[');
-
-
421 for (; i + 15 < view.size(); i += 16) {
-
422 __m128i word = _mm_loadu_si128((
const __m128i*)(view.data() + i));
-
423 __m128i m1 = _mm_cmpeq_epi8(word, mask1);
-
424 __m128i m2 = _mm_cmpeq_epi8(word, mask2);
-
425 __m128i m4 = _mm_cmpeq_epi8(word, mask4);
-
426 __m128i m5 = _mm_cmpeq_epi8(word, mask5);
-
427 __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
-
428 int mask = _mm_movemask_epi8(m);
-
-
-
-
-
433 if (i < view.size()) {
-
-
435 _mm_loadu_si128((
const __m128i*)(view.data() + view.length() - 16));
-
436 __m128i m1 = _mm_cmpeq_epi8(word, mask1);
-
437 __m128i m2 = _mm_cmpeq_epi8(word, mask2);
-
438 __m128i m4 = _mm_cmpeq_epi8(word, mask4);
-
439 __m128i m5 = _mm_cmpeq_epi8(word, mask5);
-
440 __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
-
441 int mask = _mm_movemask_epi8(m);
-
-
-
-
-
446 return size_t(view.length());
-
-
-
-
-
-
451 std::array<uint8_t, 256>
result{};
-
452 for (
int i : {
':',
'/',
'?',
'['}) {
-
-
-
-
+
+
+
+
+
+
+
+
335 size_t location)
noexcept {
+
+
337 if (view.size() - location < 16) {
+
338 for (
size_t i = location; i < view.size(); i++) {
+
339 if (view[i] ==
':' || view[i] ==
'/' || view[i] ==
'?' ||
+
+
+
+
+
344 return size_t(view.size());
+
+
346 auto to_bitmask = [](uint8x16_t input) -> uint16_t {
+
347 uint8x16_t bit_mask =
+
348 ada_make_uint8x16_t(0x01, 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x01,
+
349 0x02, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80);
+
350 uint8x16_t minput = vandq_u8(input, bit_mask);
+
351 uint8x16_t tmp = vpaddq_u8(minput, minput);
+
352 tmp = vpaddq_u8(tmp, tmp);
+
353 tmp = vpaddq_u8(tmp, tmp);
+
354 return vgetq_lane_u16(vreinterpretq_u16_u8(tmp), 0);
+
+
+
+
+
359 uint8x16_t low_mask =
+
360 ada_make_uint8x16_t(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
361 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x03);
+
362 uint8x16_t high_mask =
+
363 ada_make_uint8x16_t(0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
+
364 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
+
365 uint8x16_t fmask = vmovq_n_u8(0xf);
+
+
367 for (; i + 15 < view.size(); i += 16) {
+
368 uint8x16_t word = vld1q_u8((
const uint8_t*)view.data() + i);
+
369 uint8x16_t lowpart = vqtbl1q_u8(low_mask, vandq_u8(word, fmask));
+
370 uint8x16_t highpart = vqtbl1q_u8(high_mask, vshrq_n_u8(word, 4));
+
371 uint8x16_t classify = vandq_u8(lowpart, highpart);
+
372 if (vmaxvq_u32(vreinterpretq_u32_u8(classify)) != 0) {
+
373 uint8x16_t is_zero = vceqq_u8(classify, zero);
+
374 uint16_t is_non_zero = ~to_bitmask(is_zero);
+
+
+
+
+
379 if (i < view.size()) {
+
+
381 vld1q_u8((
const uint8_t*)view.data() + view.length() - 16);
+
382 uint8x16_t lowpart = vqtbl1q_u8(low_mask, vandq_u8(word, fmask));
+
383 uint8x16_t highpart = vqtbl1q_u8(high_mask, vshrq_n_u8(word, 4));
+
384 uint8x16_t classify = vandq_u8(lowpart, highpart);
+
385 if (vmaxvq_u32(vreinterpretq_u32_u8(classify)) != 0) {
+
386 uint8x16_t is_zero = vceqq_u8(classify, zero);
+
387 uint16_t is_non_zero = ~to_bitmask(is_zero);
+
+
+
+
391 return size_t(view.size());
+
+
+
+
395 size_t location)
noexcept {
+
+
397 if (view.size() - location < 16) {
+
398 for (
size_t i = location; i < view.size(); i++) {
+
399 if (view[i] ==
':' || view[i] ==
'/' || view[i] ==
'?' ||
+
+
+
+
+
404 return size_t(view.size());
+
+
+
+
408 const __m128i mask1 = _mm_set1_epi8(
':');
+
409 const __m128i mask2 = _mm_set1_epi8(
'/');
+
410 const __m128i mask4 = _mm_set1_epi8(
'?');
+
411 const __m128i mask5 = _mm_set1_epi8(
'[');
+
+
413 for (; i + 15 < view.size(); i += 16) {
+
414 __m128i word = _mm_loadu_si128((
const __m128i*)(view.data() + i));
+
415 __m128i m1 = _mm_cmpeq_epi8(word, mask1);
+
416 __m128i m2 = _mm_cmpeq_epi8(word, mask2);
+
417 __m128i m4 = _mm_cmpeq_epi8(word, mask4);
+
418 __m128i m5 = _mm_cmpeq_epi8(word, mask5);
+
419 __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
+
420 int mask = _mm_movemask_epi8(m);
+
+
+
+
+
425 if (i < view.size()) {
+
+
427 _mm_loadu_si128((
const __m128i*)(view.data() + view.length() - 16));
+
428 __m128i m1 = _mm_cmpeq_epi8(word, mask1);
+
429 __m128i m2 = _mm_cmpeq_epi8(word, mask2);
+
430 __m128i m4 = _mm_cmpeq_epi8(word, mask4);
+
431 __m128i m5 = _mm_cmpeq_epi8(word, mask5);
+
432 __m128i m = _mm_or_si128(_mm_or_si128(m1, m2), _mm_or_si128(m4, m5));
+
433 int mask = _mm_movemask_epi8(m);
+
+
+
+
+
438 return size_t(view.length());
+
+
+
+
+
+
443 std::array<uint8_t, 256>
result{};
+
444 for (
int i : {
':',
'/',
'?',
'['}) {
+
+
+
+
-
-
-
-
459 size_t location)
noexcept {
-
460 auto const str = view.substr(location);
-
461 for (
auto pos = str.begin(); pos != str.end(); ++pos) {
-
-
463 return pos - str.begin() + location;
-
-
-
466 return size_t(view.size());
-
+
+
+
+
451 size_t location)
noexcept {
+
452 auto const str = view.substr(location);
+
453 for (
auto pos = str.begin(); pos != str.end(); ++pos) {
+
+
455 return pos - str.begin() + location;
+
+
+
458 return size_t(view.size());
+
-
-
-
-
471 const bool is_special, std::string_view& view)
noexcept {
-
480 const size_t view_size = view.size();
-
-
482 bool found_colon =
false;
-
-
-
-
-
-
507 for (; location < view_size;
-
-
509 if (view[location] ==
'[') {
-
510 location = view.find(
']', location);
-
511 if (location == std::string_view::npos) {
-
-
-
-
515 location = view_size;
-
-
-
-
519 found_colon = view[location] ==
':';
-
-
-
-
-
-
-
-
-
528 for (; location < view_size;
-
-
530 if (view[location] ==
'[') {
-
531 location = view.find(
']', location);
-
532 if (location == std::string_view::npos) {
-
-
-
-
536 location = view_size;
-
-
-
-
540 found_colon = view[location] ==
':';
-
-
-
-
-
-
546 view.remove_suffix(view_size - location);
-
547 return {location, found_colon};
-
-
-
-
551 while (!input.empty() &&
-
552 ada::unicode::is_c0_control_or_space(input.front())) {
-
553 input.remove_prefix(1);
-
-
555 while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
-
556 input.remove_suffix(1);
-
-
-
-
-
-
-
563 ada_log(
"parse_prepared_path ", input);
-
564 uint8_t accumulator = checkers::path_signature(input);
-
-
-
-
-
569 constexpr uint8_t need_encoding = 1;
-
570 constexpr uint8_t backslash_char = 2;
-
571 constexpr uint8_t dot_char = 4;
-
572 constexpr uint8_t percent_char = 8;
-
-
-
-
-
577 (special ? (accumulator == 0)
-
578 : ((accumulator & (need_encoding | dot_char | percent_char)) ==
-
-
580 (!may_need_slow_file_handling);
-
581 if (accumulator == dot_char && !may_need_slow_file_handling) {
-
-
-
-
-
-
-
-
589 if (input[0] !=
'.') {
-
590 size_t slashdot = input.find(
"/.");
-
591 if (slashdot == std::string_view::npos) {
-
-
-
-
-
596 !(slashdot + 2 == input.size() || input[slashdot + 2] ==
'.' ||
-
597 input[slashdot + 2] ==
'/');
-
-
-
-
-
602 ada_log(
"parse_path trivial");
-
-
-
-
-
-
-
-
-
-
-
613 (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
-
-
-
616 ada_log(
"parse_prepared_path fast");
-
-
-
-
-
621 size_t previous_location = 0;
-
-
623 size_t new_location = input.find(
'/', previous_location);
-
-
-
626 if (new_location == std::string_view::npos) {
-
627 std::string_view path_view = input.substr(previous_location);
-
628 if (path_view ==
"..") {
-
-
-
-
-
-
-
635 if (path.back() ==
'/') {
-
-
-
-
-
640 path.resize(path.rfind(
'/') + 1);
-
-
-
-
644 if (path_view !=
".") {
-
645 path.append(path_view);
-
-
-
-
-
650 std::string_view path_view =
-
651 input.substr(previous_location, new_location - previous_location);
-
652 previous_location = new_location + 1;
-
653 if (path_view ==
"..") {
-
654 size_t last_delimiter = path.rfind(
'/');
-
655 if (last_delimiter != std::string::npos) {
-
656 path.erase(last_delimiter);
-
-
658 }
else if (path_view !=
".") {
-
-
660 path.append(path_view);
-
-
-
-
-
665 ada_log(
"parse_path slow");
-
-
667 bool needs_percent_encoding = (accumulator & 1);
-
668 std::string path_buffer_tmp;
-
-
670 size_t location = (special && (accumulator & 2))
-
671 ? input.find_first_of(
"/\\")
-
-
673 std::string_view path_view = input;
-
674 if (location != std::string_view::npos) {
-
675 path_view.remove_suffix(path_view.size() - location);
-
676 input.remove_prefix(location + 1);
-
-
-
-
680 std::string_view path_buffer =
-
681 (needs_percent_encoding &&
-
682 ada::unicode::percent_encode<false>(
-
-
-
-
686 if (unicode::is_double_dot_path_segment(path_buffer)) {
-
687 if ((helpers::shorten_path(path, type) || special) &&
-
688 location == std::string_view::npos) {
-
-
-
691 }
else if (unicode::is_single_dot_path_segment(path_buffer) &&
-
692 (location == std::string_view::npos)) {
-
-
-
-
696 else if (!unicode::is_single_dot_path_segment(path_buffer)) {
-
-
-
-
-
-
-
703 path += path_buffer[0];
-
-
705 path_buffer.remove_prefix(2);
-
706 path.append(path_buffer);
-
-
-
-
710 path.append(path_buffer);
-
-
-
713 if (location == std::string_view::npos) {
-
-
-
-
+
+
+
+
463 const bool is_special, std::string_view& view)
noexcept {
+
472 const size_t view_size = view.size();
+
+
474 bool found_colon =
false;
+
+
+
+
+
+
499 for (; location < view_size;
+
+
501 if (view[location] ==
'[') {
+
502 location = view.find(
']', location);
+
503 if (location == std::string_view::npos) {
+
+
+
+
507 location = view_size;
+
+
+
+
511 found_colon = view[location] ==
':';
+
+
+
+
+
+
+
+
+
520 for (; location < view_size;
+
+
522 if (view[location] ==
'[') {
+
523 location = view.find(
']', location);
+
524 if (location == std::string_view::npos) {
+
+
+
+
528 location = view_size;
+
+
+
+
532 found_colon = view[location] ==
':';
+
+
+
+
+
+
538 view.remove_suffix(view_size - location);
+
539 return {location, found_colon};
+
+
+
+
543 while (!input.empty() &&
+
544 ada::unicode::is_c0_control_or_space(input.front())) {
+
545 input.remove_prefix(1);
+
+
547 while (!input.empty() && ada::unicode::is_c0_control_or_space(input.back())) {
+
548 input.remove_suffix(1);
+
+
+
+
+
+
+
555 ada_log(
"parse_prepared_path ", input);
+
556 uint8_t accumulator = checkers::path_signature(input);
+
+
+
+
+
561 constexpr uint8_t need_encoding = 1;
+
562 constexpr uint8_t backslash_char = 2;
+
563 constexpr uint8_t dot_char = 4;
+
564 constexpr uint8_t percent_char = 8;
+
+
+
+
+
569 (special ? (accumulator == 0)
+
570 : ((accumulator & (need_encoding | dot_char | percent_char)) ==
+
+
572 (!may_need_slow_file_handling);
+
573 if (accumulator == dot_char && !may_need_slow_file_handling) {
+
+
+
+
+
+
+
+
581 if (input[0] !=
'.') {
+
582 size_t slashdot = input.find(
"/.");
+
583 if (slashdot == std::string_view::npos) {
+
+
+
+
+
588 !(slashdot + 2 == input.size() || input[slashdot + 2] ==
'.' ||
+
589 input[slashdot + 2] ==
'/');
+
+
+
+
+
594 ada_log(
"parse_path trivial");
+
+
+
+
+
+
+
+
+
+
+
605 (accumulator & (need_encoding | backslash_char | percent_char)) == 0) &&
+
+
+
608 ada_log(
"parse_prepared_path fast");
+
+
+
+
+
613 size_t previous_location = 0;
+
+
615 size_t new_location = input.find(
'/', previous_location);
+
+
+
618 if (new_location == std::string_view::npos) {
+
619 std::string_view path_view = input.substr(previous_location);
+
620 if (path_view ==
"..") {
+
+
+
+
+
+
+
627 if (path.back() ==
'/') {
+
+
+
+
+
632 path.resize(path.rfind(
'/') + 1);
+
+
+
+
636 if (path_view !=
".") {
+
637 path.append(path_view);
+
+
+
+
+
642 std::string_view path_view =
+
643 input.substr(previous_location, new_location - previous_location);
+
644 previous_location = new_location + 1;
+
645 if (path_view ==
"..") {
+
646 size_t last_delimiter = path.rfind(
'/');
+
647 if (last_delimiter != std::string::npos) {
+
648 path.erase(last_delimiter);
+
+
650 }
else if (path_view !=
".") {
+
+
652 path.append(path_view);
+
+
+
+
+
657 ada_log(
"parse_path slow");
+
+
659 bool needs_percent_encoding = (accumulator & 1);
+
660 std::string path_buffer_tmp;
+
+
662 size_t location = (special && (accumulator & 2))
+
663 ? input.find_first_of(
"/\\")
+
+
665 std::string_view path_view = input;
+
666 if (location != std::string_view::npos) {
+
667 path_view.remove_suffix(path_view.size() - location);
+
668 input.remove_prefix(location + 1);
+
+
+
+
672 std::string_view path_buffer =
+
673 (needs_percent_encoding &&
+
674 ada::unicode::percent_encode<false>(
+
+
+
+
678 if (unicode::is_double_dot_path_segment(path_buffer)) {
+
679 if ((helpers::shorten_path(path, type) || special) &&
+
680 location == std::string_view::npos) {
+
+
+
683 }
else if (unicode::is_single_dot_path_segment(path_buffer) &&
+
684 (location == std::string_view::npos)) {
+
+
+
+
688 else if (!unicode::is_single_dot_path_segment(path_buffer)) {
+
+
+
+
+
+
+
695 path += path_buffer[0];
+
+
697 path_buffer.remove_prefix(2);
+
698 path.append(path_buffer);
+
+
+
+
702 path.append(path_buffer);
+
+
+
705 if (location == std::string_view::npos) {
+
+
+
+
+
+
+
712bool overlaps(std::string_view input1,
const std::string& input2)
noexcept {
+
713 ada_log(
"helpers::overlaps check if string_view '", input1,
"' [",
+
714 input1.size(),
" bytes] is part of string '", input2,
"' [",
+
715 input2.size(),
" bytes]");
+
716 return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
+
717 input1.data() < input2.data() + input2.size();
-
720bool overlaps(std::string_view input1,
const std::string& input2)
noexcept {
-
721 ada_log(
"helpers::overlaps check if string_view '", input1,
"' [",
-
722 input1.size(),
" bytes] is part of string '", input2,
"' [",
-
723 input2.size(),
" bytes]");
-
724 return !input1.empty() && !input2.empty() && input1.data() >= input2.data() &&
-
725 input1.data() < input2.data() + input2.size();
-
+
720template <
class url_type>
+
+
722 url_type& url)
noexcept {
+
723 ada_log(
"helpers::strip_trailing_spaces_from_opaque_path");
+
724 if (!url.has_opaque_path)
return;
+
725 if (url.has_hash())
return;
+
726 if (url.has_search())
return;
-
728template <
class url_type>
-
-
730 url_type& url)
noexcept {
-
731 ada_log(
"helpers::strip_trailing_spaces_from_opaque_path");
-
732 if (!url.has_opaque_path)
return;
-
733 if (url.has_hash())
return;
-
734 if (url.has_search())
return;
-
-
736 auto path = std::string(url.get_pathname());
-
737 while (!path.empty() && path.back() ==
' ') {
-
738 path.resize(path.size() - 1);
-
-
740 url.update_base_pathname(path);
-
-
-
-
-
-
-
746 std::array<uint8_t, 256>
result{};
-
747 for (uint8_t i : {
'@',
'/',
'\\',
'?'}) {
-
-
-
-
+
728 auto path = std::string(url.get_pathname());
+
729 while (!path.empty() && path.back() ==
' ') {
+
730 path.resize(path.size() - 1);
+
+
732 url.update_base_pathname(path);
+
+
+
+
+
+
+
738 std::array<uint8_t, 256>
result{};
+
739 for (uint8_t i : {
'@',
'/',
'\\',
'?'}) {
+
+
+
+
-
-
-
754find_authority_delimiter_special(std::string_view view)
noexcept {
-
-
-
757 for (
auto pos = view.begin(); pos != view.end(); ++pos) {
-
-
759 return pos - view.begin();
-
-
-
762 return size_t(view.size());
-
-
-
-
-
-
767 std::array<uint8_t, 256>
result{};
-
768 for (uint8_t i : {
'@',
'/',
'?'}) {
-
-
-
-
+
+
+
746find_authority_delimiter_special(std::string_view view)
noexcept {
+
+
+
749 for (
auto pos = view.begin(); pos != view.end(); ++pos) {
+
+
751 return pos - view.begin();
+
+
+
754 return size_t(view.size());
+
+
+
+
+
+
759 std::array<uint8_t, 256>
result{};
+
760 for (uint8_t i : {
'@',
'/',
'?'}) {
+
+
+
+
-
-
-
775find_authority_delimiter(std::string_view view)
noexcept {
-
-
-
778 for (
auto pos = view.begin(); pos != view.end(); ++pos) {
-
-
780 return pos - view.begin();
-
-
-
783 return size_t(view.size());
-
-
-
-
-
-
-
-
-
+
+
+
767find_authority_delimiter(std::string_view view)
noexcept {
+
+
+
770 for (
auto pos = view.begin(); pos != view.end(); ++pos) {
+
+
772 return pos - view.begin();
+
+
+
775 return size_t(view.size());
+
+
+
+
+
+
-
792#undef ada_make_uint8x16_t
-
+
784#undef ada_make_uint8x16_t
+
Includes all definitions for Ada.
Definitions for URL specific checkers used within Ada.
Common definitions for cross-platform compiler support.
@@ -908,17 +900,17 @@
constexpr bool is_normalized_windows_drive_letter(std::string_view input) noexcept
constexpr bool is_windows_drive_letter(std::string_view input) noexcept
Includes the definitions for helper functions.
-
ada_really_inline size_t find_next_host_delimiter(std::string_view view, size_t location) noexcept
-
static constexpr std::array< uint8_t, 256 > authority_delimiter_special
-
static constexpr std::array< uint8_t, 256 > host_delimiters
-
ada_really_inline size_t find_next_host_delimiter_special(std::string_view view, size_t location) noexcept
+
ada_really_inline size_t find_next_host_delimiter(std::string_view view, size_t location) noexcept
+
static constexpr std::array< uint8_t, 256 > authority_delimiter_special
+
static constexpr std::array< uint8_t, 256 > host_delimiters
+
ada_really_inline size_t find_next_host_delimiter_special(std::string_view view, size_t location) noexcept
ada_unused std::string get_state(ada::state s)
-
static constexpr std::array< uint8_t, 256 > authority_delimiter
-
static constexpr std::array< uint8_t, 256 > special_host_delimiters
-
ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept
-
-
-
+
static constexpr std::array< uint8_t, 256 > authority_delimiter
+
static constexpr std::array< uint8_t, 256 > special_host_delimiters
+
ada_really_inline int trailing_zeroes(uint32_t input_num) noexcept
+
+
+
ada_warn_unused std::string to_string(encoding_type type)
diff --git a/d3/d37/unicode-inl_8h_source.html b/d3/d37/unicode-inl_8h_source.html
index dc4ced541..7faf789a8 100644
--- a/d3/d37/unicode-inl_8h_source.html
+++ b/d3/d37/unicode-inl_8h_source.html
@@ -124,15 +124,14 @@
20 const uint8_t character_set[]) {
-
-
23 std::find_if(input.begin(), input.end(), [character_set](
const char c) {
-
24 return character_sets::bit_at(character_set, c);
-
-
+
22 input.begin(), std::ranges::find_if(input, [character_set](
const char c) {
+
23 return character_sets::bit_at(character_set, c);
+
+
-
-
-
+
+
+
#define ada_really_inline
Includes the declarations for unicode operations.
ada_really_inline size_t percent_encode_index(const std::string_view input, const uint8_t character_set[])
diff --git a/d3/dbe/namespaceada_1_1checkers.html b/d3/dbe/namespaceada_1_1checkers.html
index 0810651b0..33e9c35da 100644
--- a/d3/dbe/namespaceada_1_1checkers.html
+++ b/d3/dbe/namespaceada_1_1checkers.html
@@ -410,7 +410,7 @@
tl::expected< result_type, ada::errors > result
-
Definition at line 61 of file checkers.cpp.
+
Definition at line 60 of file checkers.cpp.
diff --git a/d4/dd6/checkers_8cpp_source.html b/d4/dd6/checkers_8cpp_source.html
index a264ac979..2636e00cb 100644
--- a/d4/dd6/checkers_8cpp_source.html
+++ b/d4/dd6/checkers_8cpp_source.html
@@ -126,124 +126,123 @@
-
14 char last_char = view.back();
-
-
16 if (last_char ==
'.') {
-
17 view.remove_suffix(1);
-
-
-
-
21 last_char = view.back();
-
-
23 bool possible_ipv4 = (last_char >=
'0' && last_char <=
'9') ||
-
24 (last_char >=
'a' && last_char <=
'f') ||
-
-
-
-
-
-
30 size_t last_dot = view.rfind(
'.');
-
31 if (last_dot != std::string_view::npos) {
-
-
33 view = view.substr(last_dot + 1);
-
-
-
-
-
-
42 if (view.size() == 1) {
-
-
-
-
46 if (!view.starts_with(
"0x")) {
-
-
-
-
50 if (view.size() == 2) {
-
-
-
-
-
55 return std::all_of(view.begin() + 2, view.end(),
-
56 ada::unicode::is_lowercase_hex);
-
-
-
-
-
-
-
-
63 std::array<uint8_t, 256>
result{};
-
64 for (
size_t i = 0; i < 256; i++) {
-
65 if (i <= 0x20 || i == 0x22 || i == 0x23 || i == 0x3c || i == 0x3e ||
-
66 i == 0x3f || i == 0x60 || i == 0x7b || i == 0x7d || i > 0x7e) {
-
-
68 }
else if (i == 0x25) {
-
-
70 }
else if (i == 0x2e) {
-
-
72 }
else if (i == 0x5c) {
-
-
-
-
-
-
-
+
+
15 if (view.ends_with(
'.')) {
+
16 view.remove_suffix(1);
+
+
+
+
+
21 char last_char = view.back();
+
22 bool possible_ipv4 = (last_char >=
'0' && last_char <=
'9') ||
+
23 (last_char >=
'a' && last_char <=
'f') ||
+
+
+
+
+
+
29 size_t last_dot = view.rfind(
'.');
+
30 if (last_dot != std::string_view::npos) {
+
+
32 view = view.substr(last_dot + 1);
+
+
+
+
+
+
41 if (view.size() == 1) {
+
+
+
+
45 if (!view.starts_with(
"0x")) {
+
+
+
+
49 if (view.size() == 2) {
+
+
+
+
+
54 return std::all_of(view.begin() + 2, view.end(),
+
55 ada::unicode::is_lowercase_hex);
+
+
+
+
+
+
+
+
62 std::array<uint8_t, 256>
result{};
+
63 for (
size_t i = 0; i < 256; i++) {
+
64 if (i <= 0x20 || i == 0x22 || i == 0x23 || i == 0x3c || i == 0x3e ||
+
65 i == 0x3f || i == 0x60 || i == 0x7b || i == 0x7d || i > 0x7e) {
+
+
67 }
else if (i == 0x25) {
+
+
69 }
else if (i == 0x2e) {
+
+
71 }
else if (i == 0x5c) {
+
+
+
+
+
+
+
-
-
-
82 std::string_view input)
noexcept {
-
-
-
-
-
-
-
89 uint8_t accumulator{};
-
90 for (; i + 7 < input.size(); i += 8) {
-
-
-
-
-
-
-
-
-
-
100 for (; i < input.size(); i++) {
-
-
-
-
-
-
-
107 std::string_view input)
noexcept {
-
108 if (input.back() ==
'.') {
-
109 if (input.size() > 254)
return false;
-
110 }
else if (input.size() > 253)
-
-
-
-
114 while (start < input.size()) {
-
115 auto dot_location = input.find(
'.', start);
-
-
117 if (dot_location == std::string_view::npos) dot_location = input.size();
-
-
119 auto label_size = dot_location - start;
-
120 if (label_size > 63 || label_size == 0)
return false;
-
-
122 start = dot_location + 1;
-
-
-
-
-
+
+
+
81 std::string_view input)
noexcept {
+
+
+
+
+
+
+
88 uint8_t accumulator{};
+
89 for (; i + 7 < input.size(); i += 8) {
+
+
+
+
+
+
+
+
+
+
99 for (; i < input.size(); i++) {
+
+
+
+
+
+
+
106 std::string_view input)
noexcept {
+
107 if (input.back() ==
'.') {
+
108 if (input.size() > 254)
return false;
+
109 }
else if (input.size() > 253)
+
+
+
+
113 while (start < input.size()) {
+
114 auto dot_location = input.find(
'.', start);
+
+
116 if (dot_location == std::string_view::npos) dot_location = input.size();
+
+
118 auto label_size = dot_location - start;
+
119 if (label_size > 63 || label_size == 0)
return false;
+
+
121 start = dot_location + 1;
+
+
+
+
+
Declarations for URL specific checkers used within Ada.
#define ada_really_inline
Includes the definitions for validation functions.
-
static constexpr std::array< uint8_t, 256 > path_signature_table
+
static constexpr std::array< uint8_t, 256 > path_signature_table
constexpr bool is_digit(char x) noexcept
tl::expected< result_type, ada::errors > result
diff --git a/d5/d25/url-getters_8cpp_source.html b/d5/d25/url-getters_8cpp_source.html
index 88a80d16a..3bce83684 100644
--- a/d5/d25/url-getters_8cpp_source.html
+++ b/d5/d25/url-getters_8cpp_source.html
@@ -223,9 +223,9 @@
Definitions for helper functions used within Ada.
Definitions for user facing functions for parsing URL and it's components.
constexpr std::string_view is_special_list[]
-
-
-
+
+
+
tl::expected< result_type, ada::errors > result
ada_warn_unused ada::result< result_type > parse(std::string_view input, const result_type *base_url=nullptr)
diff --git a/d5/d36/parser_8h_source.html b/d5/d36/parser_8h_source.html
index 4b6f23298..cc81bd571 100644
--- a/d5/d36/parser_8h_source.html
+++ b/d5/d36/parser_8h_source.html
@@ -153,7 +153,7 @@
Definition for supported encoding types.
Includes the definitions for supported parsers.
template url parse_url< url >(std::string_view user_input, const url *base_url)
-
result_type parse_url(std::string_view user_input, const result_type *base_url=nullptr)
+
result_type parse_url(std::string_view user_input, const result_type *base_url=nullptr)
template url parse_url_impl< url >(std::string_view user_input, const url *base_url)
template url_aggregator parse_url_impl< url_aggregator >(std::string_view user_input, const url_aggregator *base_url)
template url_aggregator parse_url< url_aggregator >(std::string_view user_input, const url_aggregator *base_url)
diff --git a/d5/dee/url-setters_8cpp_source.html b/d5/dee/url-setters_8cpp_source.html
index 9e6e1dbd8..8531737bf 100644
--- a/d5/dee/url-setters_8cpp_source.html
+++ b/d5/dee/url-setters_8cpp_source.html
@@ -302,70 +302,60 @@
-
180 query = ada::unicode::percent_encode(std::string_view(new_value),
-
181 query_percent_encode_set);
-
+
180 query = ada::unicode::percent_encode(new_value, query_percent_encode_set);
+
diff --git a/d6/d0e/url_8cpp.html b/d6/d0e/url_8cpp.html
index 4b71cedb5..766c5cd4c 100644
--- a/d6/d0e/url_8cpp.html
+++ b/d6/d0e/url_8cpp.html
@@ -121,6 +121,7 @@