Commit 1500ca3
committed
fix: correct lenient query matching for +, fragments, and standalone {&var}
Three fixes to the two-phase query matching path:
Replaced parse_qs with a manual &/= split using unquote(). parse_qs
follows application/x-www-form-urlencoded semantics where + decodes
to space, but RFC 6570 and RFC 3986 treat + as a literal sub-delim.
A client sending ?q=C++ previously got 'C '; the path-portion
decoder (unquote) already handled this correctly, so the two code
paths disagreed.
Fragment is now stripped before splitting on ?. A URI like
logs://api?level=error#section1 previously returned
level='error#section1' via the lenient path while the strict-regex
path correctly stopped at #.
_split_query_tail now requires the trailing tail to start with a
{?...} expression. A standalone {&page} expands with an & prefix
(no ?), so partition('?') found no split and the path regex failed.
Such templates now fall through to strict regex which handles them
correctly. Also extends the path-portion check to bail on {?...}
expressions left in the path, not just literal ?.1 parent 7891fd9 commit 1500ca3
File tree
2 files changed
+54
-11
lines changed2 files changed
+54
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
449 | 451 | | |
450 | 452 | | |
451 | 453 | | |
452 | 454 | | |
453 | 455 | | |
454 | 456 | | |
455 | 457 | | |
456 | | - | |
| 458 | + | |
457 | 459 | | |
458 | 460 | | |
459 | | - | |
| 461 | + | |
460 | 462 | | |
461 | 463 | | |
462 | 464 | | |
| |||
468 | 470 | | |
469 | 471 | | |
470 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
471 | 493 | | |
472 | 494 | | |
473 | 495 | | |
| |||
535 | 557 | | |
536 | 558 | | |
537 | 559 | | |
538 | | - | |
539 | | - | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
540 | 571 | | |
541 | | - | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
542 | 576 | | |
543 | 577 | | |
544 | 578 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
440 | 446 | | |
441 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
442 | 451 | | |
443 | 452 | | |
444 | 453 | | |
| |||
0 commit comments