[fpc-devel] Patch for FCL-web; bug fixes and improvements for CGI and Apache applications

ABorka fpc-devel at aborka.com
Sun Mar 1 07:06:34 CET 2009


Hi,

I posted the following patch as
http://bugs.freepascal.org/view.php?id=13254

(includes the changes posted in 13250 and 13228 too)

1. Added: CGI and Apache applications' temporary uploaded files will be 
deleted after a request is handled /html forms with file upload(s)/ so 
the files are not left there in the temporary directory.

2. Fixed: Temporary files are not created with a single CRLF in them for 
html forms where no file(s) were uploaded.

3. Added: Apache applications are now processing and passing the input 
parameters (QueryFields, ContentFields, uploaded files, etc.). This was 
only there for CGI applications.

4. THTTPHeader and descendants RemoteAddress property renamed to 
RemoteAddr for Delphi compatibility

5. Note: For some unknown reason for apache mods the

ap_get_remote_host(FRequest^.Connection, FRequest^.Per_Dir_Config, 
REMOTE_HOST, Nil)
call is always crashing, therefore for now this field is not populated. 
This would force a DNS lookup according to the HostnameLookups setting 
in the Apache configuration.

6. Minor changes and corrections in comments here and there in FCL-web

7. Added custom header handling to CGI and Apache applications
(ex: can send "Pragma: no-cache" header now, can do redirects, etc.)

8. Added the procedure SendRedirect(const TargetURL:String) to CGI and 
Apache applications
("302 Found" for HTTP/1.0 and "307 Temporary Redirect" for HTTP/1.1)

9. Fixed a bug for Apache applications that returned with the same 
action results after any action with the use of TFPTemplate called
(the FPTemplate which is a global property for a web module was not 
reset after an action was handled)

10. Fixed a bug for Apache applications to pass the Status Code and 
Content Encoding to the web server in the response.
(ex: can send 'Content-Type: text/html; charset=ISO-8859-2' now to the 
clients, redirects need it too to pass the status code, etc.)

11. Fixed the header name/value pair passing for Apache applications
(do not need the extra space for the header values, apache puts it there
automatically)

12. Minor changes to the template usage example projects in some 
comments (the Template:TFPTemplate is a property of the web module, not 
the web action)

13. Changed the behaviour for CGI and Apache applications when non 
existing actions are called. Until now, an error message was displayed. 
Now the default action is called if it exists. If not, an error message 
is displayed.

14. fptemplate.txt is extended with more code snippets and step by step 
instructions on how to create apache and cgi applications that are using 
templates.

15. Example projects were created for the above step by step guide into
/packages/fcl-web/examples/ about the usage of template files





More information about the fpc-devel mailing list