3

Does anyone have a sample of THttpApiServer (found on Synopse)? I am not able to find any document about creating a simple webserver using this class.

Rafael Colucci
  • 6,018
  • 4
  • 52
  • 121

1 Answers1

5

You could have used our forum to ask this! ;)

The class is self-explained: please read all comments of all properties and methods, and you'll find here all useful information.

I've just uploaded a demo of this component.

It's able to serve some hard drive content, using a virtual directory layout. Directory list is created in Delphi code. File downloads are handled by http.sys at kernel-level mode.

See this new file available in our Source Code Repository.

Arnaud Bouchez
  • 42,305
  • 3
  • 71
  • 159
  • Is this class stable? I mean, can I use it in a production environment ? – Rafael Colucci Mar 24 '11 at 16:34
  • I just wrote this class. From my tests, it works fine. Most of the work is done by http.sys itself. I've written this wrapper using the official documentation from Microsoft. It's also tested in the automated regression tests of our framework. I know some companies using http.sys as their main http server on production. It's very reliable under Windows: it's the core of IIS. – Arnaud Bouchez Mar 24 '11 at 17:29
  • Ok .. I will give it a try. I am using indy to build my webservers, but I think that indy is very slow sometimes and theres nothing i can do to speed it. Do you think http.sys is faster than indy? – Rafael Colucci Mar 24 '11 at 20:26
  • In all cases, http.sys is faster than Indy, because it runs in Kernel mode, and that it was optimized for speed. You could even speed up our implementation by adding the "content cache" feature. Indy will be definitively slower because: it uses a lot of code (in which some part is not optimized), does not use I/O completion ports, run in user mode, has an old design (even for latests versions). – Arnaud Bouchez Mar 25 '11 at 13:20
  • 1
    Well .. My webserver generates different data for every request received, so i cant use content cache. But I will definitely give your code a try. Btw, you did a good job in this class. – Rafael Colucci Mar 25 '11 at 13:27
  • Another thing: can you give me a link explaining what you mean by " I/O completion ports" ? – Rafael Colucci Mar 25 '11 at 13:27
  • Just google for it [IOCP](http://en.wikipedia.org/wiki/Input/output_completion_port) or search in [SO](http://stackoverflow.com/questions/2302267/is-there-a-i-o-completion-port-based-component-for-delphi) – Arnaud Bouchez Mar 27 '11 at 13:30