Q: new web project: "HTTP Server Application" lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- IPguy · 2012-06-02 00:09 I'm just getting started making a web application and have some very basic questions. When should I use the "HTTP Server Application" vs the various CGI projects? Only when I do not want to have a web server already installed? Is there a tutorial available for creating a "HTTP Server Application" project? ---------------------------------------------------------------------- Leledumbo · 2012-06-02 02:20 QuoteWhen should I use the "HTTP Server Application" vs the various CGI projects? Only when I do not want to have a web server already installed? Is there a tutorial available for creating a "HTTP Server Application" project?When you want to have standalone web application, both the server and your application are embedded inside single executable. Another reason would be if you want to have stateful web application. There's no specific tutorial as the coding would be the same with (F)CGI version, it only differs in the .lpr a little. However, there's one gotcha (which also applicable to FCGI): due to its stateful nature, you have to ensure that your code is stateless unless intended so. For example: first request: Request comesOpen db connectionProcessGive responseNote that the connection hasn't been closed. second request: Request comesOpen db connection --> ERRORCGI would have the db connection automatically closed because the application live range is only along the request flow. However, it's safe to have it closed explicitly in CGI. So if you want to have the code sharable among the 3 mechanisms, always cleanup your mess before ending request flow is a good idea. ---------------------------------------------------------------------- IPguy · 2012-06-03 02:41 I located and was able to get running the \fpc\source\packages\fcl- web\examples\httpserver demo, although the demo seem fragile. -Using Firefox; refreshing several times causes the demo to end hmmm - this behavior appears to be by design. -I've seen a message about missing version once (do not remember exactly the message) -refreshing occasionally causes the debugger to show up. hints for the beginners: - Create a html file and put in it the same directory as the httpserver.exe.  (I created: index.html) - With the httpserver running, point your favorite browser to: http://localhost:8080/index.html laz 1.1-36568-2.6.1, win32-Vista ---------------------------------------------------------------------- Leledumbo · 2012-06-03 04:07 Quoterefreshing occasionally causes the debugger to show upThe component uses exceptions in many places, which would be caught by the debugger first before it's handled.