mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-05 19:00:32 -05:00
fix percent encoding on control chars
This commit is contained in:
parent
1c61c39172
commit
1318d46efa
1 changed files with 2 additions and 1 deletions
|
|
@ -6,7 +6,8 @@ let percent_encode ?(skip = fun _ -> false) s =
|
|||
| ( ' ' | '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+'
|
||||
| ',' | '/' | ':' | ';' | '=' | '?' | '@' | '[' | ']' | '~' ) as c ->
|
||||
Printf.bprintf buf "%%%X" (Char.code c)
|
||||
| c when Char.code c > 127 -> Printf.bprintf buf "%%%X" (Char.code c)
|
||||
| c when Char.code c < 32 || Char.code c > 127 ->
|
||||
Printf.bprintf buf "%%%X" (Char.code c)
|
||||
| c -> Buffer.add_char buf c)
|
||||
s;
|
||||
Buffer.contents buf
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue