Archived Forum Post

Index of archived forum posts


Feature request: any plan to implement a small HTTP/HTTPS server in the library ?

Dec 28 '16 at 09:37

Is there a plan to include a small web server into the lib ? I would looking for a function allowing to serve simple websites to a local browser and to use HTML, JS and UI to an else service running in background.

Any proven good alternatives ?


I would say there's no such thing as a simple web server. If Chilkat were to introduce a simple HTTP server-side class to receive HTTP requests and respond, then it would quickly prove to be inadequate. Each user would find some feature that he/she needed. Everybody would find themselves in the situation where the simple HTTP server covers 95% of the needs. But collectively, it's the vast number of features that comprise the last 5% that is the bulk of the project..

Anyway.. an easy way to receive an HTTP request is to write code using Chilkat.Socket that does the following:

  1. Accept the incoming connection.
  2. Read the "start line". Do this by reading to the first CRLF.
  3. Read the header by reading to the double-CRLF (i.e. CRLFCRLF)
  4. Load the header into a Chilkat.Mime object. This gives you easy access to all the information.
  5. Examine the Content-Length, if present, and consume the request body by reading that number of bytes.

Of course, there are all sorts of situations. What if the request is "chunked"? What about compression? What about multipart requests? Etc..