Introduction to HttpServer configuration file parameters
WebPath: The publishing path of the web website, which is equivalent to the command line parameter "-W".
HomePage: The homepage of the web website, equivalent to the command line parameter "-H".
Port: The port number of the web service, which is equivalent to the command line parameter "-P".
TimeOut: Timeout in seconds, the default value is 60 seconds.
MaxConn: The maximum number of concurrencies, equivalent to the command line parameter "-M", the default value is 20000.
PostDataPath: The saving path of uploaded data. The default value is the current user's temp directory.
1. Usage scenario 1: When the user uploads a file, the temporary path to save the uploaded file;
2. Usage scenario 2: When making a post request, if the user's post data is too large and exceeds the threshold specified by the "MaxPostCacheFileSize" field, It will be converted to file storage to prevent excessive memory usage;
MaxPostCacheFileSize: When making a POST request, receive the maximum value of the POST data cache. If it exceeds this value, the cache will be transferred to a file in bytes;
MaxUploadFileSize: Maximum upload file size, unit M bytes, default value is 2G.
UseCacheMem: Whether to use cache, the default value is 0, indicating not to use. If a cache is used, the server will trade space for time, pre-allocate several continuous large memory blocks, and overload the malloc and free functions to find available "fragmented" memory in the pre-allocated large memory blocks, thus reducing the slowdown caused by frequent application and destruction of memory under high concurrency.
UseCacheClass: Whether to use structure (struct/class) cache, the default value is 0, indicating not to use. If this value is used, the server will trade space for time, that is, according to the number of concurrency specified by MaxConn, the specified memory space will be opened up in advance. If MaxConn is 20,000, 20,000 corresponding structures (struct/class) will be opened to save context data during HTTP sessions. Same as above, this value is also to reduce the slowdown caused by frequent memory application and destruction under high concurrency.
UseMappingFile: Whether to use Mapping File to access disk files. The default value is 1, indicating use.
AccessControlAllowOrigin: Whether cross-domain is allowed, the default value is 1, which means it is allowed.
PrintMessage: Whether to output HTTP requests on the console. The default value is 1, indicating print output.
Note: Be sure to turn off console output when concurrency is high!!!
AllowUpload: Whether to allow uploading. The default value is 0, which means it is not allowed.
AllowCacheFile: Whether to allow file caching. The default value is 1, which means it is allowed. When this value is valid, the file will be cached to avoid frequent disk file operations.
MaxCacheFileSize: The maximum cached file size. The default value is 5 (unit M). Files smaller than this value will be loaded into the memory. Subsequent accesses will no longer read from the disk but directly read the memory.
HttpServerContent-Type type setting
Through the ContentType.ini configuration file, users can add the Content-Type type of the specified file type. When the browser reads the file from the server,
The server will return the specified Content-Type to the browser based on the configuration file.
The configuration format is as follows, .File extension: Content-Type
.mp4:video/mp4 means that if it is an mp4 file, the Content-Type is video/mp4.
.cc:text/plain, indicating that if it is a cc file, the content-Type is text/plain.
HttpServerCGI gateway settings
The CGI gateway is set in the CGI.xml file. The meaning of each node is as follows:
Path: The directory where the CGI gateway file is located. Here is the full path. The path is not necessarily in the published web directory (it will be safer if it is not in the web directory).
Timeout: Timeout for executing the gateway program, in seconds. The default value is 10 seconds to prevent some gateway programs from not exiting or not exiting for a long time.
cgi:子节点,每个cgi子节点代表一个CGI网关类型。
cgi/name: The name of the CGI node, such as python, indicates that the gateway file in the CGI is a python script.
cgi/exe: The full path of the application that executes the script, such as: c:python25python.exe.
cgi/action: Response configuration, this node represents an HTTP request command that needs to be processed (an application on the server side). This node has two fields, as follows:
cgi/action/appname: The request command (application name) in the url, such as: python/test1.do
cgi/action/filename: The file that handles the above request, such as: test1.py. The file must be in the directory specified by the above path node.
1. Transmission of QUERY-SRING data
python/test1.do?key1=value1&key2=value2
"key1=value1&key2=value2" will be passed to the caller through command line parameters.
In python: sys.argv[1], see the case: test2.py for details.
2. Transmission of POST-DATA data
The transfer of POST data is obtained by reading the standard input, which is: sys.stdin.readline() in python. For details, see the case: test1.py.
1. HttpServer does not pass QUERY-STRING through environment variables;
2. When the CGI gateway data is returned, the server will automatically add the Content-Length field (the respective lengths of the HTTP response header and response body are calculated based on the returned data "rnrn");
3. If there is no "rnrn" in the data returned by the CGI gateway to separate the HTTP response header and response body, the server will consider the response data to be plain text, and automatically add a response header of type "text/plain" and return it to the browser;
Users can configure multiple cgi sub-nodes as needed to process different types of gateway programs (or scripts). There are two reserved nodes configured by cgi, one is bat and the other is exe. For bat format script files under Windows, there is no need to specify an execution program, and the same is true for exe files.
Click here to download, the gateway case file is in the cgi-bin directory
The gateway configuration file is as follows:
python gateway file case:
BAT batch processing gateway file case:
Exe gateway file case:
HttpServer built-in upload interface
Interface name: command/upload.do
Use the post command to upload files to the web publishing directory.
If you want to upload files to a subdirectory of the web directory, you can specify it through the path parameter, as follows
Command/upload.do?path=subfolder, subfolder is a subdirectory relative to the web directory.
HttpServer update log
Optimize user feedback issues and improve detailed experience
Huajun editor recommends:
The editor guarantees that as long as you use HttpServer, if you don't like it, you can come and hit me! The editor has also prepared for youTelnet Server,Foxmail Server,xampp,SDF Viewer,WinShell


















Useful
Useful
Useful