(*
OCaml HTTP - do it yourself (fully OCaml) HTTP daemon
- Copyright (C) <2002> Stefano Zacchiroli <zack@cs.unibo.it>
+ Copyright (C) <2002-2004> Stefano Zacchiroli <zack@cs.unibo.it>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
| 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)