File tree 1 file changed +10
-17
lines changed
1 file changed +10
-17
lines changed Original file line number Diff line number Diff line change 6
6
open Scgi
7
7
open Lwt
8
8
9
- let _ =
9
+ let () =
10
10
(* Command line options *)
11
11
let port = ref 8080 in
12
12
let addr = ref " 127.0.0.1" in
13
13
14
14
Arg. parse
15
- (Arg. align
16
- [" --port" , Arg. Set_int port, Printf. sprintf " port number (default: %d)" ! port;
17
- " --addr" , Arg. Set_string addr, Printf. sprintf " ip address to bind (default: %s)" ! addr;
18
- ]
15
+ (Arg. align [
16
+ " --port" , Arg. Set_int port,
17
+ Printf. sprintf " port number (default: %d)" ! port;
18
+
19
+ " --addr" , Arg. Set_string addr,
20
+ Printf. sprintf " ip address to bind (default: %s)" ! addr;
21
+ ]
19
22
)
20
23
(fun s -> failwith (Printf. sprintf " Unknown argument: [%s]" s))
21
24
" try --help" ;
22
25
23
26
(* Start the handler *)
24
- Server. handler_inet " hello" ! addr ! port (fun r ->
27
+ let _server = Server. handler_inet " hello" ! addr ! port (fun r ->
25
28
Lwt. return
26
29
{ Response. status = `Ok ;
27
30
headers = [`Content_type " text/plain" ];
28
31
body = `String (" Hello world: " ^ Request. path r);
29
32
}
30
- );
33
+ ) in
31
34
32
35
(* Run forever in foreground. *)
33
36
Lwt_main. run (fst (Lwt. wait () ))
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
You can’t perform that action at this time.
0 commit comments