From b1bd861e3aaeef9e65ce1d35e5ae7d8db5f0d0e9 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Mon, 24 May 2004 12:46:57 +0000 Subject: [PATCH] implemented hostname resolution for "addr" parameter --- helm/DEVEL/ocaml-http/http_misc.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) -- 2.39.2