Skip to content

Commit 196dac9

Browse files
committed
Ocsigen_server.start: Rename 'File' to 'Unix'
The name 'Unix' makes it more clear that it will make a unix-domain socket and not a regular file.
1 parent 6103a55 commit 196dac9

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

src/extensions/accesscontrol.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let ip s =
4141
let r =
4242
match Ocsigen_request.remote_ip_parsed ri with
4343
| `Ip ip -> Ipaddr.Prefix.mem ip prefix
44-
| `File _ -> false
44+
| `Unix _ -> false
4545
in
4646
if r
4747
then
@@ -224,7 +224,7 @@ let allow_forward_for_handler ?(check_equal_ip = false) () =
224224
let equal_ip =
225225
match Ocsigen_request.remote_ip_parsed request_info with
226226
| `Ip r_ip -> Ipaddr.compare proxy_ip r_ip = 0
227-
| `File _ -> false
227+
| `Unix _ -> false
228228
in
229229
if equal_ip || not check_equal_ip
230230
then

src/server/ocsigen_cohttp.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ let service ?ssl ~address ~port ~connector () =
226226
(* We create a specific context for Conduit and Cohttp. *)
227227
let src =
228228
match address with
229-
| `File _ -> None
229+
| `Unix _ -> None
230230
| _ -> Some (Ocsigen_config.Socket_type.to_string address)
231231
in
232232
Conduit_lwt_unix.init ?src ~tls_own_key () >>= fun conduit_ctx ->
@@ -239,7 +239,7 @@ let service ?ssl ~address ~port ~connector () =
239239
let config = Cohttp_lwt_unix.Server.make ~conn_closed ~callback () in
240240
let mode =
241241
match address, tls_own_key with
242-
| (`File _ as s), _ -> `Unix_domain_socket s
242+
| `Unix f, _ -> `Unix_domain_socket (`File f)
243243
| _, `None -> `TCP (`Port port)
244244
| _, `TLS (crt, key, pass) -> `OpenSSL (crt, key, pass, `Port port)
245245
in

src/server/ocsigen_config.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ type ssl_info =
2929

3030
module Socket_type = struct
3131
type t =
32-
[`All | `IPv4 of Unix.inet_addr | `IPv6 of Unix.inet_addr | `File of string]
32+
[`All | `IPv4 of Unix.inet_addr | `IPv6 of Unix.inet_addr | `Unix of string]
3333

3434
let to_string = function
3535
| `All -> Unix.string_of_inet_addr Unix.inet_addr_any
3636
| `IPv4 u -> Unix.string_of_inet_addr u
3737
| `IPv6 u -> Unix.string_of_inet_addr u
38-
| `File s -> s
38+
| `Unix s -> s
3939
end
4040

4141
type socket_type = Socket_type.t

src/server/ocsigen_config.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type ssl_info =
2929

3030
module Socket_type : sig
3131
type t =
32-
[`All | `IPv4 of Unix.inet_addr | `IPv6 of Unix.inet_addr | `File of string]
32+
[`All | `IPv4 of Unix.inet_addr | `IPv6 of Unix.inet_addr | `Unix of string]
3333

3434
val to_string : t -> string
3535
end

src/server/ocsigen_request.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type t =
5555
; r_filenames : string list ref
5656
; r_sockaddr : Lwt_unix.sockaddr
5757
; r_remote_ip : string Lazy.t
58-
; r_remote_ip_parsed : [`Ip of Ipaddr.t | `File of string] 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
@@ -97,7 +97,7 @@ let make
9797
(match sockaddr with
9898
| Unix.ADDR_INET (ip, _port) ->
9999
`Ip (Ipaddr.of_string_exn (Unix.string_of_inet_addr ip))
100-
| ADDR_UNIX f -> `File f)
100+
| ADDR_UNIX f -> `Unix f)
101101
in
102102
{ r_address = address
103103
; r_port = port

src/server/ocsigen_request.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ val post_params :
7575
-> (string * string) list Lwt.t option
7676

7777
val remote_ip : t -> string
78-
val remote_ip_parsed : t -> [`Ip of Ipaddr.t | `File of string]
78+
val remote_ip_parsed : t -> [`Ip of Ipaddr.t | `Unix of string]
7979
val forward_ip : t -> string list
8080
val content_type : t -> content_type option
8181
val request_cache : t -> Polytables.t

test/extensions/deflatemod.t/test.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ let () =
22
Logs.Src.set_level Deflatemod.section (Some Logs.Debug);
33
Logs.set_level ~all:true (Some Logs.Debug);
44
Ocsigen_server.start
5-
~ports:[ (`File "./local.sock", 0) ]
5+
~ports:[ (`Unix "./local.sock", 0) ]
66
~veryverbose:() ~debugmode:true ~logdir:"log" ~datadir:"data"
77
~uploaddir:None ~usedefaulthostname:true ~command_pipe:"local.cmd"
88
~default_charset:(Some "utf-8")

0 commit comments

Comments
 (0)