-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.fs
More file actions
39 lines (31 loc) · 1.01 KB
/
Program.fs
File metadata and controls
39 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(* ported to .NET 8 as Web Server by:
<[WolfSpider]>
This work is licensed under the Apache 2.0 license.
See http://www.apache.org/licenses/LICENSE-2.0 for details.
Copyright (C) 2012--2015 Microsoft Research and INRIA *)
module HttpEntryPoint
open System
open System.IO
open System.Net
let try_read_mimes path =
try
Mime.of_file path
with :? IOException as e ->
Console.WriteLine("cannot read mime-types: " + e.Message)
Mime.MimeMap()
type options =
{ rootdir: string
certdir: string
dhdir: string
localaddr: IPEndPoint
localname: string
remotename: string option }
let _ =
HttpLogger.HttpLogger.Level <- HttpLogger.INFO
//let _ = Fiber.demo()
let mimesmap = try_read_mimes (Path.Combine("./htdocs", "mime.types")) in
HttpServer.run
{ docroot = "./htdocs"
mimesmap = mimesmap
localaddr = IPEndPoint(IPAddress.Loopback, 2443)
servname = "localhost" }