Mega Code Archive

 
Categories / Delphi / Ide Indy
 

Developing Webserver Applications with Delphi PART I

Title: Developing Webserver-Applications with Delphi - PART I Question: What is a Webserver-App and how can I develop it with Delphi? Answer: Release 1 last update: [26.05.2000] --------------------------------------------- Developing Webserver-Applications in Delphi --------------------------------------------- ------------------------------------ PART I: CGI and ISAPI-Applications ------------------------------------ - Introduction I wrote this article to show you the advantages of CGI and ISAPI, and to show you how easy it is to write such applications with Delphi. - About Web-Server-Applications Webserver-Applications are EXE or DLL-Files which are stored on a HTTP-Webserver and can be executed by client-requests. The client can request informations from the Webserver, and the Webserver-Application can respond on this informations by giving a MIME-formatted result to the client. This MIME-content can be defined by any known content-type like "text/plain" for a standard-text output, "text/html" for a html-content or "image/gif" for a GIF-image. For example you want execute the Web-Application output.exe stored on the remote-machine test.com. This Web-Application give us an GIF-image which is provided by the server, the output is in the image/gif format. The file we want to get is given in the first parameter of the request. To get the image test.gif from the server, we enter this in our web-browser: http://test.com/cgi-bin/output.exe/SHOWIMAGE?test.gif ------ -------- ------- ---------- --------- -------- 1 2 3 4 5 6 Description of the different sections in this address: 1. The machine use a Webserver with the HTTP-Protocol (basis for CGI/ISAPI) 2. Host or IP from the Webserver 3. CGI-Directory which stores the file output.exe 4. Our CGI-Webserver-Application 5. Command for the Webserver-Application 6. First parameter for the application separated through "?" - About CGI/ISAPI The technology behind these Webserver-Application are called CGI or ISAPI. CGI is the classic Webserver-App with the EXE-extention, and ISAPI is the newer one with the DLL- extention. Both of have the same functions. There is also a technology called Win-CGI which works a little differently than the other technologys, but this is unrelevant when developing such apps with Delphi. - Comparing CGI/ISAPI A CGI Webserver-Application is an standard Windows console application. Each request message is handled by a seperate instance of the app. A ISAPI-Application is a DLL-file that is loaded by the Webserver. The only relevant difference between the CGI-App is that each request message is handled on a seperate execution thread by one and the same instance of the ISAPI-DLL. --------------------------------------------------------------- End of this part