--- C:/Program Files/Borland/Delphi7/Source/Internet/HTTPD2_old.pas	Fri Jul 08 14:13:38 2005
+++ R:/PROJECTS/feedreaderengine/newsbrain_websources/apachesharedmod/HTTPD2.pas	Tue Mar 22 00:30:46 2011
@@ -86,10 +86,25 @@
 uses Libc;
 {$ENDIF}
 
+
+// --------------------------------------------------------------------------
+// 15.06.2008 Ingmar; added possibility to choose versions !
+// to support 2.0. ; 2.2.
+// --------------------------------------------------------------------------
+{$I apacheversions.inc}
+// --------------------------------------------------------------------------
+
+
 const
 {$IFDEF MSWINDOWS}
+
   LibHTTPD = 'libhttpd.dll'; {do not localize}
+  {$if defined(supportApache20)}
   LibAPR = 'libapr.dll';     {do not localize}
+  {$elseif defined(supportApache22)}
+  LibAPR = 'libapr-1.dll';
+  {$ifend}
+
   {$A8}
 {$ENDIF}
 
@@ -102,6 +117,14 @@
   LibAPR = '';
 {$ENDIF}
 
+
+
+
+
+
+
+
+
 type
   uid_t = Integer;              // system type
   {$EXTERNALSYM uid_t}
@@ -223,20 +246,39 @@
 
 (* End apr_tables.h *)
 
+
+
+
+
 {$HPPEMIT '#include <http_config.h>'}
 (*
  * @file http_config.h
  * @brief Apache Configuration
  *)
+
+
+
+
+
+
 const
-  MODULE_MAGIC_COOKIE = $041503230;                 (* "AP20" *)
-  {$EXTERNALSYM MODULE_MAGIC_COOKIE}
-  MODULE_MAGIC_NUMBER_MAJOR = 20020612;
-  {$EXTERNALSYM MODULE_MAGIC_NUMBER_MAJOR}
-  MODULE_MAGIC_NUMBER_MINOR = 1;                   (* 0...n *)
-  {$EXTERNALSYM MODULE_MAGIC_NUMBER_MINOR}
+
+
+
+
+
+  // MODULE_MAGIC_NUMBER_MAJOR = 20020612;
+  //{$EXTERNALSYM MODULE_MAGIC_NUMBER_MAJOR}
+
+  // MODULE_MAGIC_NUMBER_MINOR = 1;                   (* 0...n *)
+  //{$EXTERNALSYM MODULE_MAGIC_NUMBER_MINOR}
+
+
+
+
+  // --------------------------------------------------------------------------
   MODULE_MAGIC_NUMBER = MODULE_MAGIC_NUMBER_MAJOR; (* backward compat *)
-  {$EXTERNALSYM MODULE_MAGIC_NUMBER}
+  // {$EXTERNALSYM MODULE_MAGIC_NUMBER}
 
 
 (* Hook orderings *)
@@ -287,7 +329,8 @@
     TAKE3,			(*< three arguments only *)
     TAKE23,			(*< two or three arguments *)
     TAKE123,			(*< one, two or three arguments *)
-    TAKE13			(*< one or three arguments *)
+    TAKE13,			(*< one or three arguments *)
+    TAKE_ARGV			(**< an argc and argv are passed *)
   );
   {$EXTERNALSYM cmd_how}
 (*
@@ -717,6 +760,94 @@
   apr_bucket_alloc_t = {$IFDEF LINUX}packed{$ENDIF} record end;
   {$EXTERNALSYM apr_bucket_alloc_t}
 
+
+
+
+
+  // 16.06.2008 Ingmar
+  (*
+  struct conn_state_t {
+    /** APR_RING of expiration timeouts */
+    APR_RING_ENTRY(conn_state_t) timeout_list;
+    /** the expiration time of the next keepalive timeout */
+    apr_time_t expiration_time;
+    /** Current state of the connection */
+    conn_state_e state;
+    /** connection record this struct refers to */
+    conn_rec *c;
+    /** memory pool to allocate from */
+    apr_pool_t *p;
+    /** bucket allocator */
+    apr_bucket_alloc_t *bucket_alloc;
+    /** poll file decriptor information */
+    apr_pollfd_t pfd;
+  };
+  *) 
+
+  
+
+ // http://64.233.183.104/search?q=cache:ufj3a9JMwPcJ:www.wenhq.com.cn/article/view_204.html+delphi+conn_state_t&hl=en&ct=clnk&cd=1
+ conn_state_e = (CONN_STATE_CHECK_REQUEST_LINE_READABLE,
+                 CONN_STATE_READ_REQUEST_LINE,
+                 CONN_STATE_LINGER);
+
+  (** Used in apr_pollfd_t to determine what the apr_descriptor is *)
+  apr_datatype_e = ( APR_NO_DESC, //**< nothing here */
+                     APR_POLL_SOCKET, //**< descriptor refers to a socket
+                     APR_POLL_FILE, //**< descriptor refers to a file */
+                     APR_POLL_LASTDESC); //**< descriptor is the last one in the list */
+
+ (** Union of either an APR file or socket. *)
+ apr_descriptor = {$IFDEF LINUX}packed{$ENDIF} record
+  case Byte of
+    0: (f: Papr_file_t);
+    1: (s: Papr_socket_t);
+  end;
+
+  
+  (** Poll descriptor set. *)
+  apr_pollfd_t = {$IFDEF LINUX}packed{$ENDIF} record
+    p: Papr_pool_t; (*< associated pool *)
+    desc_type: apr_datatype_e; (*< descriptor type *)
+    reqevents: SmallInt; (*< requested events *)
+    rtnevents: SmallInt; (*< returned events *)
+    desc: apr_descriptor; (*< @see apr_descriptor *)
+    client_data: Pointer; (*< allows app to associate context *)
+ end;
+
+  (** A structure to contain connection state information *)
+  Pconn_state_t = ^conn_state_t;
+  conn_state_t = {$IFDEF LINUX}packed{$ENDIF} record
+     (** APR_RING of expiration timeouts *)
+     timeout_list: record
+       next: Pconn_state_t;
+       prev: Pconn_state_t;
+     end;
+
+    (** the expiration time of the next keepalive timeout *)
+    expiration_time: apr_time_t;
+    (** Current state of the connection *)
+    state: conn_state_e;
+    (** connection record this struct refers to *)
+    c: Pconn_rec;
+    (** memory pool to allocate from *)
+    p: Papr_pool_t;
+    (** bucket allocator *)
+    bucket_alloc: Papr_bucket_alloc_t;
+    (** poll file decriptor information *)
+    pfd: Pointer;//apr_pollfd_t;
+  end;
+ {$EXTERNALSYM conn_state_t}
+
+
+
+
+
+
+  // 13.06.2008 Ingmar
+  ap_conn_keepalive_e = (AP_CONN_UNKNOWN, AP_CONN_CLOSE, AP_CONN_KEEPALIVE);
+
+
 (** Structure to store things which are per connection *)
   conn_rec = {$IFDEF LINUX}packed{$ENDIF} record
     (** Pool associated with this connection *)
@@ -742,8 +873,11 @@
      *  get_remote_logname() *)
     remote_logname: PChar;
 
+
+
+    
     (** Are we still talking? *)
-    flags: Cardinal;
+    //flags: Cardinal;
     { The following are in the flags bitset:
     unsigned aborted:1;
 
@@ -755,6 +889,25 @@
      *  1 yes/success *)
     signed int double_reverse:2;
     }
+
+    // 13.06.2008 Ingmar
+    (** 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;
+    }
+
+
     (** How many times have we used it? *)
     keepalives: Integer;
     (** server IP address *)
@@ -778,7 +931,22 @@
     sbh: Pointer;
     (** The bucket allocator to use for all bucket/brigade creations *)
     bucket_alloc: Papr_bucket_alloc_t;
+
+    // ------------------------------------------------------------------------    
+    // 16.06.2008 Ingmar
+    // ------------------------------------------------------------------------
+    {$ifdef supportApache22}
+    (** The current state of this connection *)
+     cs : Pconn_state_t;
+    (** Is there data pending in the input filters? *)
+     data_in_input_filters : integer;
+    (** Are there any filters that clogg/buffer the input stream, breaking
+      *  the event mpm. *)
+     clogging_input_filters : integer;
+    {$endif}
+    // -----------------
   end;
+
   {$EXTERNALSYM conn_rec}
 
 (*
@@ -1377,6 +1545,10 @@
 
 (* A structure to be used for Per-vhost config *)
 
+
+
+  {$if  defined(supportApache20)}
+  
   Pserver_addr_rec = ^server_addr_rec;
   server_addr_rec = {$IFDEF LINUX}packed{$ENDIF} record
     (* The next server in the list *)
@@ -1388,6 +1560,28 @@
     (* The name given in <VirtualHost> *)
     virthost: PChar;
   end;
+
+  {$elseif defined(supportApache22)}
+
+  Pserver_addr_rec = ^server_addr_rec;
+  server_addr_rec = {$IFDEF LINUX}packed{$ENDIF} record
+    (* The next server in the list *)
+    next: Pserver_addr_rec;
+    (* limit on size of the HTTP request line *)
+    limit_req_line: Integer;
+    (* limit on size of any request header field *)
+    limit_req_fieldsize: Integer;
+    (* limit on number of request header fields *)
+    limit_req_fields: Integer;
+    (** The server request scheme for redirect responses *)
+     server_scheme: PChar;
+    end;
+
+  {$ifend}
+
+
+
+  
   {$EXTERNALSYM server_addr_rec}
 
 (* A structure to store information for each virtual server *)
@@ -1457,6 +1651,12 @@
     limit_req_fieldsize: Integer;
     (* limit on number of request header fields  *)
     limit_req_fields: Integer;
+    
+    // 16.06.2008 Ingmar added
+    {$ifdef supportApache22}
+    server_scheme : pchar;
+    {$endif}
+
   end;
   {$EXTERNALSYM server_rec}
 
@@ -3700,5 +3900,4 @@
 procedure ap_run_insert_filter; external LibHTTPD name LibNamePrefix + 'ap_run_insert_filter' + LibSuff4;
 function ap_hook_get_insert_filter; external LibHTTPD name LibNamePrefix + 'ap_hook_get_insert_filter' + LibSuff0;
 
-end.
-
+end.
\ No newline at end of file
