From: Stefano Zacchiroli Date: Mon, 24 May 2004 12:46:57 +0000 (+0000) Subject: implemented hostname resolution for "addr" parameter X-Git-Tag: V_0_0_9~4 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=b1bd861e3aaeef9e65ce1d35e5ae7d8db5f0d0e9;p=helm.git implemented hostname resolution for "addr" parameter --- diff --git a/helm/DEVEL/ocaml-http/http_misc.ml b/helm/DEVEL/ocaml-http/http_misc.ml index 5b04f2c37..fcec70ca5 100644 --- a/helm/DEVEL/ocaml-http/http_misc.ml +++ b/helm/DEVEL/ocaml-http/http_misc.ml @@ -98,7 +98,9 @@ let reason_phrase_of_code = function | invalid_code -> raise (Invalid_code invalid_code) let build_sockaddr (addr, port) = - Unix.ADDR_INET (Unix.inet_addr_of_string addr, port) + try + Unix.ADDR_INET ((Unix.gethostbyname addr).Unix.h_addr_list.(0), port) + with Not_found -> failwith ("OCaml-HTTP, can't resolve hostname: " ^ addr) let explode_sockaddr = function | Unix.ADDR_INET (addr, port) -> (Unix.string_of_inet_addr addr, port)