Delphi Clinic C++Builder Gate Training & Consultancy Delphi Notes Weblog Dr.Bob's Webshop
Bob Swart (aka Dr.Bob) - Medical Officer Kylix Developer's Guide
 Dr.Bob's Tip-Of-The-Hat #11
See Also: Delphi Papers, Columns and other Tip-Of-The-Hats

Apache DSO and Post with Kylix 1.0
People have been asking me to explain why in Kylix 1.0, the Request.ContentFields.Values['variable_name'] is not returning the variable value from a form when they try this from an Apache DSO (while it works very well using an Apache CGI application).
The explanation, as also mention in my WebBroker chapters of Kylix Developer's Guide is as follows: There is a bug in the shipping version of Kylix 1.0 Server Developer when using POST in combination with a DSO web server application. The problem is that the Request.ContentFields will remain empty, even if information was posted. The Request.Content does have a value, it's just that this value is not broken into individual ContentFields.
An unofficial fix, provided by Shane Hausle of Borland, involves adding one line of code to the file ApacheHTTP.pas (but first you need to make a backup of this file - just in case). In this unit, find the TApacheResponse.GetStringVariable function, and add the following case after '15:'

  16: Result := ap_table_get(FRequest_rec^.headers_in,'Content-Length');
Now, copy the ApacheHTTP.pas to the lib directory (you may also want to add it to your project explicitly) and when you compile it also compile the fixed ApacheHTTP.pas file and produce new .dcu files that fix the above problem.
Note that this is an unofficial fix, and you may need to restore the original version of ApacheHTTP.pas before you can apply any upcoming official fixes or patches from Borland (so always make a backup of your ApacheHTTP.pas and ApacheHTTP.dcu files before you start applying this fix).

Note that this problem is fixed in Kylix 2, so you don't have to worry if you're using WebBroker with Kylix 2.

This webpage © 2001-2009 by Bob Swart (aka Dr.Bob - All Rights Reserved.