@@ -49,13 +49,13 @@ let make_uri u =
4949 {u_uri; u_get_params; u_get_params_flat; u_path; u_path_string}
5050
5151type t =
52- { r_address : Unix .inet_addr
52+ { r_address : Ocsigen_config.Socket_type .t
5353 ; r_port : int
5454 ; r_ssl : bool
5555 ; r_filenames : string list ref
5656 ; r_sockaddr : Lwt_unix .sockaddr
5757 ; r_remote_ip : string Lazy .t
58- ; r_remote_ip_parsed : Ipaddr .t Lazy .t
58+ ; r_remote_ip_parsed : [ `Ip of Ipaddr .t | `Unix of string ] Lazy .t
5959 ; r_forward_ip : string list
6060 ; r_uri : uri
6161 ; r_meth : Cohttp.Code .meth
@@ -88,10 +88,16 @@ let make
8888 =
8989 let r_remote_ip =
9090 lazy
91- (Unix. string_of_inet_addr (Ocsigen_lib.Ip_address. of_sockaddr sockaddr))
91+ (match sockaddr with
92+ | Unix. ADDR_INET (ip , _port ) -> Unix. string_of_inet_addr ip
93+ | ADDR_UNIX f -> f)
9294 in
9395 let r_remote_ip_parsed =
94- lazy (Ipaddr. of_string_exn (Lazy. force r_remote_ip))
96+ lazy
97+ (match sockaddr with
98+ | Unix. ADDR_INET (ip , _port ) ->
99+ `Ip (Ipaddr. of_string_exn (Unix. string_of_inet_addr ip))
100+ | ADDR_UNIX f -> `Unix f)
95101 in
96102 { r_address = address
97103 ; r_port = port
@@ -146,7 +152,8 @@ let update
146152 match forward_ip with Some forward_ip -> forward_ip | None -> r_forward_ip
147153 and r_remote_ip, r_remote_ip_parsed =
148154 match remote_ip with
149- | Some remote_ip -> lazy remote_ip, lazy (Ipaddr. of_string_exn remote_ip)
155+ | Some remote_ip ->
156+ lazy remote_ip, lazy (`Ip (Ipaddr. of_string_exn remote_ip))
150157 | None -> r_remote_ip, r_remote_ip_parsed
151158 and r_sub_path = match sub_path with Some _ -> sub_path | None -> r_sub_path
152159 and r_body =
0 commit comments