FPC HTTP Server handling the LOCATION http header lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Graeme · 2013-09-26 10:25 Has anybody implemented the FPC HTTP Server component to handle the HTTP Header "Location". The Location header is set by the CGI client application, and tells the web server to redirect to another URL. ---------------------------------------------------------------------- Graeme · 2013-09-26 10:52 In the mean time I found a quick work-around solution (even though this is frowned upon by the W3C). Instead of using a server side redirect, I generate a HTML page that tells the web browser to redirect. I use the META tag and JavaScript to make sure most browsers are supported. Code: [Select]
---------------------------------------------------------------------- Leledumbo · 2013-09-26 15:31 Webserver redirection is supported. TResponse class has SendRedirect method, use that followed by SendContent (if not done yet). ---------------------------------------------------------------------- Graeme · 2013-09-26 18:36 Quote from: Leledumbo on September 26, 2013, 05:31:42 pmWebserver redirection is supported. TResponse class has SendRedirect method, use that followed by SendContent (if not done yet). But what about the Embedded WebServer parsing the HTTP Header looking for the "Location: xyz" information? I looked through all the fphttpserver.pp unit code, and any http server related units, and can't see any code that processes the "Location" header data. note: I'm not talking about a fcl-web CGI client application asking for a redirect, but rather the processing that needs to be done by the Web Server component - receiving such a request. ---------------------------------------------------------------------- Leledumbo · 2013-09-27 11:19 QuoteBut what about the Embedded WebServer parsing the HTTP Header looking for the "Location: xyz" information? I looked through all the fphttpserver.pp unit code, and any http server related units, and can't see any code that processes the "Location" header data. note: I'm not talking about a fcl-web CGI client application asking for a redirect, but rather the processing that needs to be done by the Web Server component - receiving such a request.No idea, the SendRedirect method only sets 302 http result code and sets the redirect location. It's then the browser that interprets the 302 and redirect location to go to the correct address. ---------------------------------------------------------------------- Graeme · 2013-09-27 14:15 Thanks, I'll investigate this further.