mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
net.urllib: allow urllib.parse_query("format=%l")
This commit is contained in:
parent
683eaad66f
commit
dcab79146b
2 changed files with 27 additions and 14 deletions
|
@ -53,8 +53,9 @@ fn should_escape(c byte, mode EncodingMode) bool {
|
|||
// we could possibly allow, and parse will reject them if we
|
||||
// escape them (because hosts can`t use %-encoding for
|
||||
// ASCII bytes).
|
||||
if
|
||||
c in [`!`, `$`, `&`, `\\`, `(`, `)`, `*`, `+`, `,`, `;`, `=`, `:`, `[`, `]`, `<`, `>`, `"`] {
|
||||
if c in [`!`, `$`, `&`, `\\`, `(`, `)`, `*`, `+`, `,`, `;`, `=`, `:`, `[`, `]`, `<`, `>`,
|
||||
`"`,
|
||||
] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -158,6 +159,11 @@ fn unescape(s_ string, mode EncodingMode) ?string {
|
|||
}
|
||||
n++
|
||||
if i + 2 >= s.len || !ishex(s[i + 1]) || !ishex(s[i + 2]) {
|
||||
if mode == .encode_query_component && i + 1 < s.len {
|
||||
s = s[..i] + '%25' + s[(i + 1)..]
|
||||
i += 4 // skip the %25 and the next character
|
||||
continue
|
||||
}
|
||||
s = s[i..]
|
||||
if s.len > 3 {
|
||||
s = s[..3]
|
||||
|
@ -789,7 +795,7 @@ pub fn parse_query(query string) ?Values {
|
|||
// but any errors will be silent
|
||||
fn parse_query_silent(query string) Values {
|
||||
mut m := new_values()
|
||||
parse_query_values(mut m, query) or { }
|
||||
parse_query_values(mut m, query) or {}
|
||||
return m
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue