@@ -33,8 +33,8 @@ module Ip_address = struct
3333 in
3434 let options =
3535 [ (if v6
36- then Lwt_unix. AI_FAMILY Lwt_unix. PF_INET6
37- else Lwt_unix. AI_FAMILY Lwt_unix. PF_INET ) ]
36+ then Lwt_unix. AI_FAMILY Lwt_unix. PF_INET6
37+ else Lwt_unix. AI_FAMILY Lwt_unix. PF_INET ) ]
3838 in
3939 Lwt. bind (Lwt_unix. getaddrinfo host " " options) aux
4040
@@ -181,7 +181,7 @@ module Url = struct
181181
182182 let fixup_url_string1 =
183183 Netstring_pcre. global_substitute problem_re1 (fun m s ->
184- Printf. sprintf " %%%02x" (Char. code s.[fst (Pcre. get_substring_ofs m 0 )]))
184+ Printf. sprintf " %%%02x" (Char. code s.[fst (Pcre. get_substring_ofs m 0 )]))
185185
186186 (* I add this fixup to handle %uxxxx sent by browsers.
187187 Translated to %xx%xx *)
@@ -191,11 +191,11 @@ module Url = struct
191191 fixup_url_string1
192192 (Netstring_pcre. global_substitute problem_re2
193193 (fun m s ->
194- String. concat " "
195- [ " %"
196- ; Netstring_pcre. matched_group m 1 s
197- ; " %"
198- ; Netstring_pcre. matched_group m 2 s ])
194+ String. concat " "
195+ [ " %"
196+ ; Netstring_pcre. matched_group m 1 s
197+ ; " %"
198+ ; Netstring_pcre. matched_group m 2 s ])
199199 s)
200200
201201 (* VVV This is in Netencoding but we have a problem with ~
@@ -296,19 +296,19 @@ module Url = struct
296296 let l = String. length s1 in
297297 Netstring_pcre. global_substitute url_decoding_re
298298 (fun r _ ->
299- match Netstring_pcre. matched_string r s1 with
300- | "+" -> if plus then " " else " +"
301- | _ -> (
302- let i = fst (Pcre. get_substring_ofs r 0 ) in
303- (* Assertion: s1.[i] = '%' *)
304- if i + 2 > = l then failwith " decode" ;
305- let c1 = s1.[i + 1 ] in
306- let c2 = s1.[i + 2 ] in
307- try
308- let k1 = of_hex1 c1 in
309- let k2 = of_hex1 c2 in
310- String. make 1 (Char. chr ((k1 lsl 4 ) lor k2))
311- with Not_found -> failwith " decode" ))
299+ match Netstring_pcre. matched_string r s1 with
300+ | "+" -> if plus then " " else " +"
301+ | _ -> (
302+ let i = fst (Pcre. get_substring_ofs r 0 ) in
303+ (* Assertion: s1.[i] = '%' *)
304+ if i + 2 > = l then failwith " decode" ;
305+ let c1 = s1.[i + 1 ] in
306+ let c2 = s1.[i + 2 ] in
307+ try
308+ let k1 = of_hex1 c1 in
309+ let k2 = of_hex1 c2 in
310+ String. make 1 (Char. chr ((k1 lsl 4 ) lor k2))
311+ with Not_found -> failwith " decode" ))
312312 s1
313313
314314 let make_encoded_parameters params =
0 commit comments