1 module hunt.http.server.HttpRequestOptions;
2 
3 import std.file;
4 import std.path;
5 
6 /**
7  * 
8  */
9 class HttpRequestOptions {
10 
11     private int bodyBufferThreshold = 512 * 1024;
12     private int maxRequestSize = 64 * 1024 * 1024;
13     private int maxFileSize = 64 * 1024 * 1024;
14     private string tempFilePath = "./temp";
15     private string tempFileAbsolutePath = "/temp";
16     private string charset = "UTF-8";
17     private string _defaultLanguage = "en-US";
18 
19     this() {
20         tempFilePath = tempDir();
21         tempFileAbsolutePath = tempFilePath;
22     }
23 
24     int getBodyBufferThreshold() {
25         return bodyBufferThreshold;
26     }
27 
28     void setBodyBufferThreshold(int bodyBufferThreshold) {
29         this.bodyBufferThreshold = bodyBufferThreshold;
30     }
31 
32     int getMaxRequestSize() {
33         return maxRequestSize;
34     }
35 
36     void setMaxRequestSize(int maxRequestSize) {
37         this.maxRequestSize = maxRequestSize;
38     }
39 
40     int getMaxFileSize() {
41         return maxFileSize;
42     }
43 
44     void setMaxFileSize(int size) {
45         maxFileSize = size;
46     }
47 
48     string getTempFilePath() {
49         return tempFilePath;
50     }
51 
52     string getTempFileAbsolutePath() {
53         return tempFileAbsolutePath;
54     }
55 
56     void setTempFilePath(string tempFilePath) {
57         this.tempFilePath = tempFilePath;
58         string rootPath = dirName(thisExePath);
59         tempFileAbsolutePath = buildPath(rootPath, tempFilePath);
60     }
61 
62     string getCharset() {
63         return charset;
64     }
65 
66     void setCharset(string charset) {
67         this.charset = charset;
68     }
69 
70     string defaultLanguage() {
71         return _defaultLanguage;
72     }
73 
74     void defaultLanguage(string langId) {
75         _defaultLanguage = langId;
76     }
77 }