Delphi Clinic | C++Builder Gate | Training & Consultancy | Delphi Notes Weblog | Dr.Bob's Webshop |
|
As you may know, Delphi 7 ships with Apache 2.0.39 support, and won't work with .40 due to interface changes done by Apache. Here is what you need to change to support 2.0.40 up to 2.0.63 (released January 2008). |
|
Note that I have tested this, and look at the structures in memory (they appear correct; it is easy to see when they are not correct), however, it is untested and is an "unofficial fix".
MODULE_MAGIC_NUMBER_MAJOR = 20020628; { Apache 2.0.40 } MODULE_MAGIC_NUMBER_MINOR = 0;
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.41..45 } MODULE_MAGIC_NUMBER_MINOR = 0;
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.46 } MODULE_MAGIC_NUMBER_MINOR = 2; // or 3;
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.47..48 } MODULE_MAGIC_NUMBER_MINOR = 4;
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.49 } MODULE_MAGIC_NUMBER_MINOR = 7;
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.50 } MODULE_MAGIC_NUMBER_MINOR = 8;
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.51..53 } MODULE_MAGIC_NUMBER_MINOR = 9;
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.55 } MODULE_MAGIC_NUMBER_MINOR = 11;
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.56..61 } MODULE_MAGIC_NUMBER_MINOR = 12;
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.63 } MODULE_MAGIC_NUMBER_MINOR = 13;
ap_conn_keepalive_e = (AP_CONN_UNKNOWN, AP_CONN_CLOSE, AP_CONN_KEEPALIVE);
(** Are we still talking? *) flags: Cardinal; { The following are in the flags bitset: unsigned aborted:1; (** Are we going to keep the connection alive for another request? * -1 fatal error, 0 undecided, 1 yes *) signed int keepalive:2; (** have we done double-reverse DNS? -1 yes/failure, 0 not yet, * 1 yes/success *) signed int double_reverse:2; }with:
(** Are we still talking? *) flags1: Cardinal; { The following are in the flags bitset: unsigned aborted:1; } (** Are we going to keep the connection alive for another request? * @see ap_conn_keepalive_e *) keepalive: ap_conn_keepalive_e; flags2: Cardinal; { The following are in the flags bitset: (** have we done double-reverse DNS? -1 yes/failure, 0 not yet, * 1 yes/success *) signed int double_reverse:2; }
Note that in order to make this patch work with the latest release of Apache (version 2.0.41 or higher), you have to change MODULE_MAGIC_NUMBER_MAJOR to 20020903 (instead of 20020628) to make it work.
Before you modify HTTP2D.pas make sure you have a backup of the original file as well - just in case.
After you've modified HTTP2D.pas, you have to make sure that this file is "found first" by your web project, which can be done in a number of ways.
The safest is to place the new HTTPD2.pas in your project directory itself, so only this project will use the modified VCL file.
Note that anything you change in the "official" Delphi directory is "dangerous", since official patches from Borland will only patch original untouched files.
So I personally always make local copies of modified VCL files (and add them to the project directory only).
Update: note that you may also need to recompile the ApacheTwoApp.pas and ApacheTwoHTTP.pas files (because they depend on the changes in HTTP2D.pas).
So, you may want to copy these two files the LIB directory and rename their .DCU counterpart to .DCU_ as well.
Then, do a Build All (so the new .dcu files are generated).
That should work (I just rechecked it on a clean configuration).
See Leonardo's Blog for Apache 2.2.x support.
Alternately - a more dangerous approach - you can rename the HTTPD2.dcu file in the Lib directory (for example to HTTPD2.dcu_) and place the new HTTPD2.pas file in the Lib directory, so Delphi will recompile it when needed.