首页 > delphi > Delphi 7 and Apache 2.0.40 (and higher)

Delphi 7 and Apache 2.0.40 (and higher)

2008年4月24日 发表评论 阅读评论

The following information was posted in the Borland newsgroups, and provided here until it has found a permanent place on the Borland Developer’s Network website. Dr.Bob’s ** Book Top 3 ** 2003:
1. Delphi 6 Developer’s Guide
2. C++Builder 6 Developer’s Guide
3. Kylix Developer’s Guide

As you may know, Delphi 7 ships with 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 .40. 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”. I will try to post it to the borland site when I have time, and an official fix when we can.

Thanks,
Corbin
Borland RAD R&D Engineer

——————————————————————————–

Open up HTTPD2.pas
For Apache 2.0.40, change the following constants:
MODULE_MAGIC_NUMBER_MAJOR = 20020628; { Apache 2.0.40 }
MODULE_MAGIC_NUMBER_MINOR = 0;

For Apache 2.0.41 up to 2.0.45, change the following constants:
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.41..45 }
MODULE_MAGIC_NUMBER_MINOR = 0;

For Apache 2.0.46, change the following constants:
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.46 }
MODULE_MAGIC_NUMBER_MINOR = 2; // or 3;

For Apache 2.0.47 and 2.0.48, change the following constants:
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.47..48 }
MODULE_MAGIC_NUMBER_MINOR = 4;

For Apache 2.0.49, change the following constants:
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.49 }
MODULE_MAGIC_NUMBER_MINOR = 7;

For Apache 2.0.50, change the following constants:
MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.50 }
MODULE_MAGIC_NUMBER_MINOR = 8;

Before the conn_rec declaration, add:
ap_conn_keepalive_e = (AP_CONN_UNKNOWN, AP_CONN_CLOSE, AP_CONN_KEEPALIVE);

In the conn_rec structure, replace this:
(** 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.
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.

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).

分类: delphi 标签: 3,110 次阅读
原文链接:http://www.wenhq.com/article/view_203.html
欢迎转载,请注明出处:亲亲宝宝
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.