Merge commit 'upstream/2.0.1'
[pkg-ocaml-ocsigen.git] / debian / patches / 0002-Fix-wrong-decoding-of-in-URL-paths.patch
blob77198fc3d4d9f553a2c1e3f007985288ade6b8b4
1 From: Stephane Glondu <steph@glondu.net>
2 Date: Thu, 7 Jul 2011 16:47:00 +0200
3 Subject: Fix wrong decoding of + in URL paths
5 Cherry-picked from upstream.
6 ---
7 baselib/ocsigen_lib.ml | 11 +++++++++--
8 1 files changed, 9 insertions(+), 2 deletions(-)
10 diff --git a/baselib/ocsigen_lib.ml b/baselib/ocsigen_lib.ml
11 index 376fe3a..15af400 100644
12 --- a/baselib/ocsigen_lib.ml
13 +++ b/baselib/ocsigen_lib.ml
14 @@ -509,7 +509,8 @@ let string_of_url_path ~encode l =
15 then
16 fixup_url_string (String.concat "/"
17 (List.map (*Netencoding.Url.encode*)
18 - MyUrl.encode l))
19 + (MyUrl.encode ~plus:false) l))
20 + (* ' ' are not encoded to '+' in paths *)
21 else String.concat "/" l (* BYXXX : check illicit characters *)
23 let parse_url =
24 @@ -561,6 +562,12 @@ let parse_url =
26 (* Note that the fragment (string after #) is not sent by browsers *)
28 +(*20110707 ' ' is encoded to '+' in queries, but not in paths.
29 + Warning: if we write the URL manually, we must encode ' ' to '+' manually
30 + (not done by the browser).
31 + --Vincent
32 +*)
34 let get_params =
35 lazy begin
36 let params_string = match query with None -> "" | Some s -> s in
37 @@ -570,7 +577,7 @@ let parse_url =
38 end
41 - let path = List.map Netencoding.Url.decode (Neturl.split_path pathstring) in
42 + let path = List.map (Netencoding.Url.decode ~plus:false) (Neturl.split_path pathstring) in
44 let path = remove_dotdot path (* and remove "//" *)
45 (* here we remove .. from paths, as it is dangerous.
46 --