Commit 54eac49
committed
pgconn: fix parseKeywordValueSettings rejecting trailing whitespace
The key-value connection string parser failed with "invalid keyword/value"
whenever the string ended with more than one space, or when a quoted value
was followed by any trailing spaces. This is because after consuming each
value the code only stripped a single byte (s[end+1:]), leaving extra
leading whitespace that caused the next loop iteration to see a partial
string without an '=' character.
Fix by trimming all leading whitespace from the remainder of the string
after consuming each value (unquoted and quoted), and also trimming the
string once before entering the loop. This matches libpq's behaviour,
which accepts any amount of whitespace between and after key-value pairs.
Fixes #2284
Signed-off-by: alliasgher <alliasgher123@gmail.com>1 parent a5680bc commit 54eac49
2 files changed
Lines changed: 46 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
634 | 637 | | |
635 | 638 | | |
636 | 639 | | |
| |||
655 | 658 | | |
656 | 659 | | |
657 | 660 | | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
663 | 664 | | |
664 | 665 | | |
665 | 666 | | |
| |||
675 | 676 | | |
676 | 677 | | |
677 | 678 | | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
| 679 | + | |
| 680 | + | |
683 | 681 | | |
684 | 682 | | |
685 | 683 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
802 | 840 | | |
803 | 841 | | |
804 | 842 | | |
| |||
0 commit comments