mormot.net.server.pas

mormot.net.server.pas

/// HTTP server using fast http.sys kernel-mode server
// - The HTTP Server API enables applications to communicate over HTTP without
// using Microsoft Internet Information Server (IIS). Applications can register
// to receive HTTP requests for particular URLs, receive HTTP requests, and send
// HTTP responses. The HTTP Server API includes SSL support so that applications
// can exchange data over secure HTTP connections without IIS. It is also
// designed to work with I/O completion ports.
// - The HTTP Server API is supported on Windows Server 2003 operating systems
// and on Windows XP with Service Pack 2 (SP2). Be aware that Microsoft IIS 5
// running on Windows XP with SP2 is not able to share port 80 with other HTTP
// applications running simultaneously.
THttpApiServer = class(THttpServerGeneric)

/// HTTP & WebSocket server using fast http.sys kernel-mode server
// - can be used like simple THttpApiServer
// - when AddUrlWebSocket is called WebSocket support are added
// in this case WebSocket will receiving the frames in asynchronous

//需要win8,win2012及以上版本才支持
THttpApiWebSocketServer = class(THttpApiServer)

上面的2个类,都是针对WINDOWS http.sys的,因此不能用于LINUX。

/// main HTTP server Thread using the standard Sockets API (e.g. WinSock)
// - bind to a port and listen to incoming requests
// - assign this requests to THttpServerResp threads from a ThreadPool
// - it implements a HTTP/1.1 compatible server, according to RFC 2068 specifications
// - if the client is also HTTP/1.1 compatible, KeepAlive connection is handled:
// multiple requests will use the existing connection and thread;
// this is faster and uses less resources, especialy under Windows
// - a Thread Pool is used internaly to speed up HTTP/1.0 connections - a
// typical use, under Linux, is to run this class behind a NGINX frontend,
// configured as https reverse proxy, leaving default "proxy_http_version 1.0"
// and "proxy_request_buffering on" options for best performance, and
// setting KeepAliveTimeOut=0 in the THttpServer.Create constructor
// - under windows, will trigger the firewall UAC popup at first run
// - don't forget to use Free method when you are finished
THttpServer = class(THttpServerGeneric)

这个类支持WINDOWS AND LINUX。

原文地址:https://www.cnblogs.com/hnxxcxg/p/14040255.html