Skip to content
Browse files

[fix] uriParser: query_parser should transofrm + into space character

  • Loading branch information...
1 parent be384c5 commit 6818821eaf38246ca92fb6ab16753f11d5757c46 @Aqua-Ye Aqua-Ye committed
Showing with 3 additions and 4 deletions.
  1. +1 −1 stdlib/core/web/core/uri.opa
  2. +2 −3 stdlib/core/web/request/http_request.opa
View
2 stdlib/core/web/core/uri.opa
@@ -187,7 +187,7 @@ UriParser =
uric = parser a=reserved -> a | a=unreserved -> a | a=escaped -> a;
chars = parser v=uric+ -> String.flatten(v)
- uric_query = parser a=unreserved -> a | a=escaped -> a | t=([/:@+$, ]) -> Text.to_string(t) | a=unwise -> a;
+ uric_query = parser a=unreserved -> a | a=escaped -> a | [+] -> " " | t=([/:@+$, ]) -> Text.to_string(t) | a=unwise -> a;
chars_query = parser v=uric_query+ -> String.flatten(v)
opt_chars_query = parser v=uric_query* -> String.flatten(v)
View
5 stdlib/core/web/request/http_request.opa
@@ -187,13 +187,12 @@ HttpRequest = {{
* of the request.
*/
get_form_data(x: HttpRequest.request): stringmap(string) =
- decode(s) = String.replace("+", " ", Uri.decode_string(s))
match Parser.try_parse(UriParser.query_parser, get_body(x))
| {none} -> StringMap.empty
| {some=list} ->
List.fold((a, b), acc ->
- StringMap.add(decode(a), decode(b), acc)
- , list, StringMap.empty)
+ StringMap.add(a, b, acc)
+ , list, StringMap.empty)
/**
* Return the body of a XML request.

0 comments on commit 6818821

Please sign in to comment.
Something went wrong with that request. Please try again.