Plain HTTP server component — the same engine as TsgcWebSocketHTTPServer, without WebSocket support, for publishing HTTP-only services such as an MCP server.
TsgcHTTPServer is a plain HTTP server component: it shares the same underlying engine as TsgcWebSocketHTTPServer (document root, sessions, keep-alive, HTTP compression, HTTP/2, HTTP/3, TLS, authentication, thread pool, IOCP/EPOLL engines, file uploads, firewall, rate limiter...) but it never upgrades a connection to the WebSocket protocol. There is no handshake, no frames, and none of the WebSocket-only members (Extensions, Specifications, HeartBeat, QueueOptions, OnMessage/OnBinary/OnFragmented/OnHandshake, LoadBalancer/OnLoadBalancer*, Groups) are published on it.
Use TsgcHTTPServer when your application only needs to publish an HTTP endpoint and you do not want to link any WebSocket code at all, for example to host an MCP (Model Context Protocol) server, a REST/JSON API, or a plain file/document server. If you also need WebSocket support on the same port, use TsgcWebSocketHTTPServer instead.
Follow the steps below to configure this component:
1. Drop a TsgcHTTPServer component in the form
2. Set Port (default is 80). If you are behind a firewall probably you will need to configure it.
3. Handle OnCommandGet / OnCommandOther to answer requests, or set DocumentRoot to serve static files automatically.
AResponseInfo.ContentText := '<HTML><HEADER>TEST</HEAD><BODY>Hello!</BODY></HTML>';
OnHTTPUploadBeforeCreatePostStream: this event is called after the headers have been read and before the post stream is created.
* In some cases, you may get a high consume of cpu due to unsolicited connections, in these cases, just return an error 500 or close the connection from OnUnknownProtocol.
4. Create a procedure and set property Active = true.