View Issue Details

IDProjectCategoryView StatusLast Update
0025534FPCPackagespublic2014-01-24 11:45
ReporterDennis Fehr Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product Version2.7.1 
Target Version3.0.0Fixed in Version3.0.0 
Summary0025534: Patch for HTTPD24 Package
DescriptionIncludes various APR_BRIGADE_* and APR_BUCKET_* functions (in HTTPD24), a few apr_brigade_* functions, a bug fix with the apr_bucket_type_t (is_metadata is included in the type, not just an enum), which prevented (apr_bucket_read) from working. Tested for Win32/Linux64, but the way the libraries are set up, these are the only two special scenarios (win32 has the c++ mangled names
TagsNo tags attached.
Fixed in Revision26573
FPCOldBugId
FPCTarget
Attached Files

Activities

Dennis Fehr

2014-01-14 21:06

reporter  

httpd24.diff (26,239 bytes)   
Index: packages/httpd24/fpmake.pp
===================================================================
--- packages/httpd24/fpmake.pp	(revision 26407)
+++ packages/httpd24/fpmake.pp	(working copy)
@@ -59,6 +59,7 @@
           AddInclude('http_config.inc');
           AddInclude('http_core.inc');
           AddInclude('util_filter.inc');
+          AddInclude('util_script.inc');
           AddInclude('http_log.inc');
           AddInclude('http_protocol.inc');
           AddInclude('aprutil/apr_buckets.inc');
Index: packages/httpd24/src/apr/apr24.pas
===================================================================
--- packages/httpd24/src/apr/apr24.pas	(revision 26407)
+++ packages/httpd24/src/apr/apr24.pas	(working copy)
@@ -138,5 +138,4 @@
 
 implementation
 
-
 end.
Index: packages/httpd24/src/apr/apr_tables.inc
===================================================================
--- packages/httpd24/src/apr/apr_tables.inc	(revision 26407)
+++ packages/httpd24/src/apr/apr_tables.inc	(working copy)
@@ -53,6 +53,7 @@
 type
   apr_table_t = record end;
   Papr_table_t = ^apr_table_t;
+  PPapr_table_t = ^Papr_table_T;
 
 //** @see apr_array_header_t */
 //typedef struct apr_array_header_t apr_array_header_t;
@@ -458,7 +459,7 @@
 //typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key,
 //                                                    const char *value);
 type
-  apr_table_do_callback_fn_t = function (rec: Pointer; const key, value: PChar): Integer;
+  apr_table_do_callback_fn_t = function (rec: Pointer; const key, value: PChar): Integer; cdecl;
   Papr_table_do_callback_fn_t = ^apr_table_do_callback_fn_t;
 
 {**
@@ -487,6 +488,12 @@
 //#endif
 //    ;
 
+// This has to be a GNU C-Declaration
+
+function apr_table_do(comp: apr_table_do_callback_fn_t; rec: Pointer;
+  t: Papr_table_t): Integer; cdecl; varargs;
+  external LibAPR Name 'apr_table_do';
+
 {**
  * Iterate over a table running the provided function once for every
  * element in the table.  The @param vp varargs parameter must be a
@@ -509,7 +516,7 @@
 //APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp,
 //                               void *rec, const apr_table_t *t, va_list vp);
 function apr_table_vdo(comp: Papr_table_do_callback_fn_t;
-                       rec: Pointer; const t: Papr_table_t; vp: va_list): Integer;
+                       rec: Pointer; t: Papr_table_t; vp: va_list): Integer;
   {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
   external LibAPR name LibNamePrefix + 'apr_table_vdo' + LibSuff16;
 
Index: packages/httpd24/src/aprutil/apr_buckets.inc
===================================================================
--- packages/httpd24/src/aprutil/apr_buckets.inc	(revision 26407)
+++ packages/httpd24/src/aprutil/apr_buckets.inc	(working copy)
@@ -49,6 +49,10 @@
 const
 //** default bucket buffer size - 8KB minus room for memory allocator headers */
   APR_BUCKET_BUFF_SIZE = 8000;
+//** This bucket type represents actual data to send to the client. */
+  APR_BUCKET_DATA = 0;
+//** This bucket type represents metadata. */
+  APR_BUCKET_METADATA = 1;
 
 //** Determines how a bucket or brigade should be read */
 type
@@ -132,16 +136,8 @@
 //typedef struct apr_bucket_type_t apr_bucket_type_t;
 Papr_bucket_type_t = ^apr_bucket_type_t;
 
-{from below}
-is_metadata = (
-  //** This bucket type represents actual data to send to the client. */
-  APR_BUCKET_DATA = 0,
-  //** This bucket type represents metadata. */
-  APR_BUCKET_METADATA = 1
-);
-
 //    void ( *destroy)(void *data);
-  destroy_t = procedure(data: Pointer);
+  destroy_t = procedure(data: Pointer); cdecl;
 
 //    apr_status_t ( *read)(apr_bucket *b, const char **str, apr_size_t *len,
 //                         apr_read_type_e block);
@@ -181,7 +177,7 @@
      * that are the "content" of the brigade and "metadata" describes
      * that data but is not a proper part of it.
      *}
-{is_metadata is moved up}
+    is_metadata : integer;
 //    enum {
 //        /** This bucket type represents actual data to send to the client. */
 //        APR_BUCKET_DATA = 0,
@@ -253,7 +249,7 @@
 
 {from below}
 //    void (*free)(void *e);
-  free_t = procedure(e: Pointer);
+  free_t = procedure(e: Pointer); cdecl;
 
   link_t = record
     next: Papr_bucket;
@@ -341,7 +337,7 @@
  * Function called when a brigade should be flushed
  *}
 //typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
-apr_brigade_flush = function(bb: Papr_bucket_brigade; ctx: Pointer): apr_status_t;
+apr_brigade_flush = function(bb: Papr_bucket_brigade; ctx: Pointer): apr_status_t; cdecl;
 
 (*  fpc -> big part ignored here
 {*
@@ -392,14 +388,12 @@
  * @return The magic pointer value
  */
 #define APR_BRIGADE_SENTINEL(b)	APR_RING_SENTINEL(&(b)->list, apr_bucket, link)
-
 /**
  * Determine if the bucket brigade is empty
  * @param b The brigade to check
  * @return true or false
  */
 #define APR_BRIGADE_EMPTY(b)	APR_RING_EMPTY(&(b)->list, apr_bucket, link)
-
 /**
  * Return the first bucket in a brigade
  * @param b The brigade to query
@@ -412,7 +406,6 @@
  * @return The last bucket in the brigade
  */
 #define APR_BRIGADE_LAST(b)	APR_RING_LAST(&(b)->list)
-
 /**
  * Insert a list of buckets at the front of a brigade
  * @param b The brigade to add to
@@ -489,13 +482,11 @@
  * @return The previous bucket
  */
 #define APR_BUCKET_PREV(e)	APR_RING_PREV((e), link)
-
 /**
  * Remove a bucket from its bucket brigade
  * @param e The bucket to remove
  */
 #define APR_BUCKET_REMOVE(e)	APR_RING_REMOVE((e), link)
-
 /**
  * Initialize a new bucket's prev/next pointers
  * @param e The bucket to initialize
@@ -509,7 +500,6 @@
  * @return true or false
  */
 #define APR_BUCKET_IS_METADATA(e)    ((e)->type->is_metadata)
-
 /**
  * Determine if a bucket is a FLUSH bucket
  * @param e The bucket to inspect
@@ -607,7 +597,7 @@
 
 {from below}
 //    void (*free_func)(void *data);
-free_func_t = procedure (data: Pointer);
+free_func_t = procedure (data: Pointer); cdecl;
 
 {**
  * A bucket referring to data allocated off the heap.
@@ -819,8 +809,13 @@
  */
 APU_DECLARE(apr_status_t) apr_brigade_length(apr_bucket_brigade *bb,
                                              int read_all,
-                                             apr_off_t *length);
+                                             apr_off_t *length);*)
 
+function apr_brigade_length(bb: Papr_bucket_brigade; read_all: Integer;
+  length: Papr_off_t): apr_status_t; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
+  external LibAPRUtil name LibNamePrefix + 'apr_brigade_length' + LibSuff12;
+
+(*
 /**
  * Take a bucket brigade and store the data in a flat char*
  * @param bb The bucket brigade to create the char* from
@@ -830,8 +825,13 @@
  */
 APU_DECLARE(apr_status_t) apr_brigade_flatten(apr_bucket_brigade *bb,
                                               char *c,
-                                              apr_size_t *len);
+                                              apr_size_t *len);*)
 
+function apr_brigade_flatten(bb: Papr_bucket_brigade; c: Pchar;
+  len: Papr_size_t): apr_status_t;{$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
+  external LibAPRUtil name LibNamePrefix + 'apr_brigade_flatten' + LibSuff12;
+
+(*
 /**
  * Creates a pool-allocated string representing a flat bucket brigade
  * @param bb The bucket brigade to create the char array from
Index: packages/httpd24/src/httpd24.pas
===================================================================
--- packages/httpd24/src/httpd24.pas	(revision 26407)
+++ packages/httpd24/src/httpd24.pas	(working copy)
@@ -158,11 +158,94 @@
 //{$include http_connection.inc}
 //{$include http_vhost.inc}
 
-//{$include util_script.inc}
+{$include util_script.inc}
 //{$include util_time.inc}
 //{$include util_md5.inc}
 //{$include ap_mpm.inc}
 
+// APRUtil External Variables //
+
+var
+
+  {/* All of the bucket types implemented by the core */
+  /**
+   * The flush bucket type.  This signifies that all data should be flushed to
+   * the next filter.  The flush bucket should be sent with the other buckets.
+   */}
+  apr_bucket_type_flush: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The EOS bucket type.  This signifies that there will be no more data, ever.
+   * All filters MUST send all data to the next filter when they receive a
+   * bucket of this type
+   */}
+  apr_bucket_type_eos: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The FILE bucket type.  This bucket represents a file on disk
+   */}
+  apr_bucket_type_file: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The HEAP bucket type.  This bucket represents a data allocated from the
+   * heap.
+   */}
+  apr_bucket_type_heap: apr_bucket_type_t external LibAPRUtil;
+  {$IFDEF APR_HAS_MMAP}
+    {/**
+     * The MMAP bucket type.  This bucket represents an MMAP'ed file
+     */}
+    apr_bucket_type_mmap: apr_bucket_type_t external LibAPRUtil;
+  {$ENDIF}
+  {/**
+   * The POOL bucket type.  This bucket represents a data that was allocated
+   * from a pool.  IF this bucket is still available when the pool is cleared,
+   * the data is copied on to the heap.
+   */}
+  apr_bucket_type_pool: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The PIPE bucket type.  This bucket represents a pipe to another program.
+   */}
+  apr_bucket_type_pipe: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The IMMORTAL bucket type.  This bucket represents a segment of data that
+   * the creator is willing to take responsibility for.  The core will do
+   * nothing with the data in an immortal bucket
+   */}
+  apr_bucket_type_immortal: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The TRANSIENT bucket type.  This bucket represents a data allocated off
+   * the stack.  When the setaside function is called, this data is copied on
+   * to the heap
+   */}
+  apr_bucket_type_transient: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The SOCKET bucket type.  This bucket represents a socket to another machine
+   */}
+  apr_bucket_type_socket: apr_bucket_type_t external LibAPRUtil;
+
+//********************************************************************
+  { from apr_buckets.inc }
+
+  function APR_BRIGADE_SENTINEL(b: Papr_bucket_brigade): Papr_bucket;
+  function APR_BRIGADE_FIRST(b: Papr_bucket_brigade): Papr_bucket;
+  function APR_BRIGADE_LAST(b: Papr_bucket_brigade): Papr_bucket;
+  function APR_BUCKET_NEXT(e: Papr_bucket): Papr_bucket;
+  function APR_BUCKET_PREV(e: Papr_bucket): Papr_bucket;
+  procedure APR_BUCKET_REMOVE(e: Papr_bucket);
+  function APR_BUCKET_IS_METADATA(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_FLUSH(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_EOS(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_FILE(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_PIPE(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_SOCKET(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_HEAP(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_TRANSIENT(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_IMMORTAL(e: Papr_bucket): boolean;
+  {$IFDEF APR_HAS_MMAP}
+    function APR_BUCKET_IS_MMAP(e: Papr_bucket): boolean;
+  {$ENDIF}
+  function APR_BUCKET_IS_POOL(e: Papr_bucket): boolean;
+  function apr_bucket_read(e: Papr_bucket; const str: PPChar; len: Papr_size_t;
+    block: apr_read_type_e): apr_status_t;
+
 implementation
   { Internal representation for a HTTP protocol number, e.g., HTTP/1.1 }
   function HTTP_VERSION(major, minor: Integer): Integer;
@@ -245,6 +328,104 @@
   end;
 
 //********************************************************************
+  { from apr_buckets.inc }
+
+  function APR_BRIGADE_FIRST(b: Papr_bucket_brigade): Papr_bucket; inline;
+  begin
+    APR_BRIGADE_FIRST := b^.list.next;
+  end;
+
+  function APR_BRIGADE_LAST(b: Papr_bucket_brigade): Papr_bucket; inline;
+  begin
+    APR_BRIGADE_LAST := b^.list.prev;
+  end;
+
+  function APR_BRIGADE_SENTINEL(b: Papr_bucket_brigade): Papr_bucket; inline;
+  var b_: apr_bucket; // This should technically be <type> and link shouldn't be hard-coded..
+  begin
+    APR_BRIGADE_SENTINEL := Papr_bucket(pointer(@b^.list.next) - (pointer(@b_.Link) - pointer(@b_) ) );
+  end;
+
+  function APR_BUCKET_IS_METADATA(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_METADATA := e^.type_^.is_metadata = APR_BUCKET_METADATA;
+  end;
+
+  function APR_BUCKET_IS_FLUSH(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_FLUSH := e^.type_ = @apr_bucket_type_flush;
+  end;
+
+  function APR_BUCKET_IS_EOS(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_EOS := e^.type_ = @apr_bucket_type_eos;
+  end;
+
+  function APR_BUCKET_IS_FILE(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_FILE := e^.type_ = @apr_bucket_type_file;
+  end;
+
+  function APR_BUCKET_IS_PIPE(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_PIPE := e^.type_ = @apr_bucket_type_pipe;
+  end;
+
+  function APR_BUCKET_IS_SOCKET(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_SOCKET := e^.type_ = @apr_bucket_type_socket;
+  end;
+
+  function APR_BUCKET_IS_HEAP(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_HEAP := e^.type_ = @apr_bucket_type_heap;
+  end;
+
+  function APR_BUCKET_IS_TRANSIENT(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_TRANSIENT := e^.type_ = @apr_bucket_type_transient;
+  end;
+
+  function APR_BUCKET_IS_IMMORTAL(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_IMMORTAL := e^.type_ = @apr_bucket_type_immortal;
+  end;
+
+  {$IFDEF APR_HAS_MMAP}
+    function APR_BUCKET_IS_MMAP(e: Papr_bucket): boolean; inline;
+    begin
+      APR_BUCKET_IS_MMAP := e^.type_ = @apr_bucket_type_mmap;
+    end;
+  {$ENDIF}
+
+  function APR_BUCKET_IS_POOL(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_POOL := e^.type_ = @apr_bucket_type_pool;
+  end;
+
+  function APR_BUCKET_NEXT(e: Papr_bucket): Papr_bucket; inline;
+  begin
+    APR_BUCKET_NEXT := e^.link.next;
+  end;
+
+  function APR_BUCKET_PREV(e: Papr_bucket): Papr_bucket; inline;
+  begin
+    APR_BUCKET_PREV := e^.link.prev;
+  end;
+
+  procedure APR_BUCKET_REMOVE(e: Papr_bucket); inline;
+  begin
+    APR_BUCKET_PREV(e)^.link.next := APR_BUCKET_NEXT(e);
+    APR_BUCKET_NEXT(e)^.link.prev := APR_BUCKET_PREV(e);
+  end;
+
+  function apr_bucket_read(e: Papr_bucket; const str: PPChar; len: Papr_size_t;
+    block: apr_read_type_e): apr_status_t; inline;
+  begin
+    apr_bucket_read := e^.type_^.read(e, str, len, block);
+  end;
+
+//********************************************************************
   { from http_config.inc }
 
   { Use this in all standard modules }
Index: packages/httpd24/src/util_filter.inc
===================================================================
--- packages/httpd24/src/util_filter.inc	(revision 26407)
+++ packages/httpd24/src/util_filter.inc	(working copy)
@@ -135,15 +135,15 @@
  * @
   }
   ap_out_filter_func = function (f: Pap_filter_t;
-                                 b: Papr_bucket_brigade):apr_status_t;
+                                 b: Papr_bucket_brigade):apr_status_t; cdecl;
 
   ap_in_filter_func = function (f: Pap_filter_t; 
                                 b: Papr_bucket_brigade;
                                 mode: ap_input_mode_t;
                                 block: apr_read_type_e;
-                                readbytes: apr_off_t): apr_status_t;
+                                readbytes: apr_off_t): apr_status_t; cdecl;
 
-  ap_init_filter_func = function (f: Pap_filter_t): Longint;
+  ap_init_filter_func = function (f: Pap_filter_t): Longint; cdecl;
 
   Pap_filter_func = ^ap_filter_func;
   ap_filter_func = record
Index: packages/httpd24/src/util_script.inc
===================================================================
--- packages/httpd24/src/util_script.inc	(revision 0)
+++ packages/httpd24/src/util_script.inc	(working copy)
@@ -0,0 +1,242 @@
+(*
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file  util_script.h
+ * @brief Apache script tools
+ *
+ * @defgroup APACHE_CORE_SCRIPT Script Tools
+ * @ingroup  APACHE_CORE
+ * @{
+ */
+
+#ifndef APACHE_UTIL_SCRIPT_H
+#define APACHE_UTIL_SCRIPT_H
+
+#include "apr_buckets.h"
+#include "ap_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef APACHE_ARG_MAX
+#ifdef _POSIX_ARG_MAX
+#define APACHE_ARG_MAX _POSIX_ARG_MAX
+#else
+#define APACHE_ARG_MAX 512
+#endif
+#endif
+*)
+{
+/**
+ * Create an environment variable out of an Apache table of key-value pairs
+ * @param p pool to allocate out of
+ * @param t Apache table of key-value pairs
+ * @return An array containing the same key-value pairs suitable for
+ *         use with an exec call.
+ * @fn char **ap_create_environment(apr_pool_t *p, apr_table_t *t)
+ */
+AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t);
+
+/**
+ * This "cute" little function comes about because the path info on
+ * filenames and URLs aren't always the same. So we take the two,
+ * and find as much of the two that match as possible.
+ * @param uri The uri we are currently parsing
+ * @param path_info The current path info
+ * @return The length of the path info
+ * @fn int ap_find_path_info(const char *uri, const char *path_info)
+ */
+AP_DECLARE(int) ap_find_path_info(const char *uri, const char *path_info);
+
+/**
+ * Add CGI environment variables required by HTTP/1.1 to the request's
+ * environment table
+ * @param r the current request
+ * @fn void ap_add_cgi_vars(request_rec *r)
+ */
+AP_DECLARE(void) ap_add_cgi_vars(request_rec *r);
+
+/**
+ * Add common CGI environment variables to the requests environment table
+ * @param r The current request
+ * @fn void ap_add_common_vars(request_rec *r)
+ */
+AP_DECLARE(void) ap_add_common_vars(request_rec *r);
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param f The file to read from
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ * @fn int ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer)
+ */
+AP_DECLARE(int) ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer);
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param f The file to read from
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param module_index The module index to be used for logging
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE(int) ap_scan_script_header_err_ex(request_rec *r, apr_file_t *f,
+                                             char *buffer, int module_index);
+
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param bb The brigade from which to read
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ * @fn int ap_scan_script_header_err_brigade(request_rec *r, apr_bucket_brigade *bb, char *buffer)
+ */
+AP_DECLARE(int) ap_scan_script_header_err_brigade(request_rec *r,
+                                                  apr_bucket_brigade *bb,
+                                                  char *buffer);
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param bb The brigade from which to read
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param module_index The module index to be used for logging
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE(int) ap_scan_script_header_err_brigade_ex(request_rec *r,
+                                                     apr_bucket_brigade *bb,
+                                                     char *buffer,
+                                                     int module_index);
+
+/**
+ * Read headers strings from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param termch Pointer to the last character parsed.
+ * @param termarg Pointer to an int to capture the last argument parsed.
+ *
+ * The varargs are string arguments to parse consecutively for headers,
+ * with a NULL argument to terminate the list.
+ *
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r,
+                                                      char *buffer,
+                                                      const char **termch,
+                                                      int *termarg, ...)
+                       AP_FN_ATTR_SENTINEL;
+
+/**
+ * Read headers strings from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param module_index The module index to be used for logging
+ * @param termch Pointer to the last character parsed.
+ * @param termarg Pointer to an int to capture the last argument parsed.
+ *
+ * The varargs are string arguments to parse consecutively for headers,
+ * with a NULL argument to terminate the list.
+ *
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs_ex(request_rec *r,
+                                                         char *buffer,
+                                                         int module_index,
+                                                         const char **termch,
+                                                         int *termarg, ...)
+                       AP_FN_ATTR_SENTINEL;
+
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param getsfunc Function to read the headers from.  This function should
+                   act like gets()
+ * @param getsfunc_data The place to read from
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE(int) ap_scan_script_header_err_core(request_rec *r, char *buffer,
+                                               int (*getsfunc) (char *, int, void *),
+                                               void *getsfunc_data);
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param getsfunc Function to read the headers from.  This function should
+                   act like gets()
+ * @param getsfunc_data The place to read from
+ * @param module_index The module index to be used for logging
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE(int) ap_scan_script_header_err_core_ex(request_rec *r, char *buffer,
+                                        int (*getsfunc) (char *, int, void *),
+                                        void *getsfunc_data, int module_index);
+}
+
+{/**
+ * Parse query args for the request and store in a new table allocated
+ * from the request pool.
+ * For args with no value, "1" will be used instead.
+ * If no query args were specified, the table will be empty.
+ * @param r The current request
+ * @param table A new table on output.
+ */
+AP_DECLARE(void) ap_args_to_table(request_rec *r, apr_table_t **table);}
+
+procedure ap_args_to_table(r: Prequest_rec; table: PPapr_table_t);
+  {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
+  external LibHTTPD Name LibNamePrefix + 'ap_args_to_table' + LibSuff8;
+
+(*
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* !APACHE_UTIL_SCRIPT_H */
+/** @} */
+*)
+
httpd24.diff (26,239 bytes)   

Dennis Fehr

2014-01-24 04:37

reporter  

httpd24-2.diff (30,578 bytes)   
Index: packages/httpd24/fpmake.pp
===================================================================
--- packages/httpd24/fpmake.pp	(revision 26570)
+++ packages/httpd24/fpmake.pp	(working copy)
@@ -59,6 +59,7 @@
           AddInclude('http_config.inc');
           AddInclude('http_core.inc');
           AddInclude('util_filter.inc');
+          AddInclude('util_script.inc');
           AddInclude('http_log.inc');
           AddInclude('http_protocol.inc');
           AddInclude('aprutil/apr_buckets.inc');
Index: packages/httpd24/src/apr/apr24.pas
===================================================================
--- packages/httpd24/src/apr/apr24.pas	(revision 26570)
+++ packages/httpd24/src/apr/apr24.pas	(working copy)
@@ -138,5 +138,4 @@
 
 implementation
 
-
 end.
Index: packages/httpd24/src/apr/apr_tables.inc
===================================================================
--- packages/httpd24/src/apr/apr_tables.inc	(revision 26570)
+++ packages/httpd24/src/apr/apr_tables.inc	(working copy)
@@ -53,6 +53,7 @@
 type
   apr_table_t = record end;
   Papr_table_t = ^apr_table_t;
+  PPapr_table_t = ^Papr_table_T;
 
 //** @see apr_array_header_t */
 //typedef struct apr_array_header_t apr_array_header_t;
@@ -458,7 +459,7 @@
 //typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key,
 //                                                    const char *value);
 type
-  apr_table_do_callback_fn_t = function (rec: Pointer; const key, value: PChar): Integer;
+  apr_table_do_callback_fn_t = function (rec: Pointer; const key, value: PChar): Integer; cdecl;
   Papr_table_do_callback_fn_t = ^apr_table_do_callback_fn_t;
 
 {**
@@ -487,6 +488,12 @@
 //#endif
 //    ;
 
+// This has to be a GNU C-Declaration
+
+function apr_table_do(comp: apr_table_do_callback_fn_t; rec: Pointer;
+  t: Papr_table_t): Integer; cdecl; varargs;
+  external LibAPR Name 'apr_table_do';
+
 {**
  * Iterate over a table running the provided function once for every
  * element in the table.  The @param vp varargs parameter must be a
@@ -509,7 +516,7 @@
 //APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp,
 //                               void *rec, const apr_table_t *t, va_list vp);
 function apr_table_vdo(comp: Papr_table_do_callback_fn_t;
-                       rec: Pointer; const t: Papr_table_t; vp: va_list): Integer;
+                       rec: Pointer; t: Papr_table_t; vp: va_list): Integer;
   {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
   external LibAPR name LibNamePrefix + 'apr_table_vdo' + LibSuff16;
 
Index: packages/httpd24/src/aprutil/apr_buckets.inc
===================================================================
--- packages/httpd24/src/aprutil/apr_buckets.inc	(revision 26570)
+++ packages/httpd24/src/aprutil/apr_buckets.inc	(working copy)
@@ -49,6 +49,10 @@
 const
 //** default bucket buffer size - 8KB minus room for memory allocator headers */
   APR_BUCKET_BUFF_SIZE = 8000;
+//** This bucket type represents actual data to send to the client. */
+  APR_BUCKET_DATA = 0;
+//** This bucket type represents metadata. */
+  APR_BUCKET_METADATA = 1;
 
 //** Determines how a bucket or brigade should be read */
 type
@@ -132,16 +136,8 @@
 //typedef struct apr_bucket_type_t apr_bucket_type_t;
 Papr_bucket_type_t = ^apr_bucket_type_t;
 
-{from below}
-is_metadata = (
-  //** This bucket type represents actual data to send to the client. */
-  APR_BUCKET_DATA = 0,
-  //** This bucket type represents metadata. */
-  APR_BUCKET_METADATA = 1
-);
-
 //    void ( *destroy)(void *data);
-  destroy_t = procedure(data: Pointer);
+  destroy_t = procedure(data: Pointer); cdecl;
 
 //    apr_status_t ( *read)(apr_bucket *b, const char **str, apr_size_t *len,
 //                         apr_read_type_e block);
@@ -181,7 +177,7 @@
      * that are the "content" of the brigade and "metadata" describes
      * that data but is not a proper part of it.
      *}
-{is_metadata is moved up}
+    is_metadata : integer;
 //    enum {
 //        /** This bucket type represents actual data to send to the client. */
 //        APR_BUCKET_DATA = 0,
@@ -253,7 +249,7 @@
 
 {from below}
 //    void (*free)(void *e);
-  free_t = procedure(e: Pointer);
+  free_t = procedure(e: Pointer); cdecl;
 
   link_t = record
     next: Papr_bucket;
@@ -341,7 +337,7 @@
  * Function called when a brigade should be flushed
  *}
 //typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
-apr_brigade_flush = function(bb: Papr_bucket_brigade; ctx: Pointer): apr_status_t;
+apr_brigade_flush = function(bb: Papr_bucket_brigade; ctx: Pointer): apr_status_t; cdecl;
 
 (*  fpc -> big part ignored here
 {*
@@ -392,14 +388,12 @@
  * @return The magic pointer value
  */
 #define APR_BRIGADE_SENTINEL(b)	APR_RING_SENTINEL(&(b)->list, apr_bucket, link)
-
 /**
  * Determine if the bucket brigade is empty
  * @param b The brigade to check
  * @return true or false
  */
 #define APR_BRIGADE_EMPTY(b)	APR_RING_EMPTY(&(b)->list, apr_bucket, link)
-
 /**
  * Return the first bucket in a brigade
  * @param b The brigade to query
@@ -412,7 +406,6 @@
  * @return The last bucket in the brigade
  */
 #define APR_BRIGADE_LAST(b)	APR_RING_LAST(&(b)->list)
-
 /**
  * Insert a list of buckets at the front of a brigade
  * @param b The brigade to add to
@@ -489,13 +482,11 @@
  * @return The previous bucket
  */
 #define APR_BUCKET_PREV(e)	APR_RING_PREV((e), link)
-
 /**
  * Remove a bucket from its bucket brigade
  * @param e The bucket to remove
  */
 #define APR_BUCKET_REMOVE(e)	APR_RING_REMOVE((e), link)
-
 /**
  * Initialize a new bucket's prev/next pointers
  * @param e The bucket to initialize
@@ -509,7 +500,6 @@
  * @return true or false
  */
 #define APR_BUCKET_IS_METADATA(e)    ((e)->type->is_metadata)
-
 /**
  * Determine if a bucket is a FLUSH bucket
  * @param e The bucket to inspect
@@ -607,7 +597,7 @@
 
 {from below}
 //    void (*free_func)(void *data);
-free_func_t = procedure (data: Pointer);
+free_func_t = procedure (data: Pointer); cdecl;
 
 {**
  * A bucket referring to data allocated off the heap.
@@ -819,8 +809,13 @@
  */
 APU_DECLARE(apr_status_t) apr_brigade_length(apr_bucket_brigade *bb,
                                              int read_all,
-                                             apr_off_t *length);
+                                             apr_off_t *length);*)
 
+function apr_brigade_length(bb: Papr_bucket_brigade; read_all: Integer;
+  length: Papr_off_t): apr_status_t; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
+  external LibAPRUtil name LibNamePrefix + 'apr_brigade_length' + LibSuff12;
+
+(*
 /**
  * Take a bucket brigade and store the data in a flat char*
  * @param bb The bucket brigade to create the char* from
@@ -830,8 +825,13 @@
  */
 APU_DECLARE(apr_status_t) apr_brigade_flatten(apr_bucket_brigade *bb,
                                               char *c,
-                                              apr_size_t *len);
+                                              apr_size_t *len);*)
 
+function apr_brigade_flatten(bb: Papr_bucket_brigade; c: Pchar;
+  len: Papr_size_t): apr_status_t;{$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
+  external LibAPRUtil name LibNamePrefix + 'apr_brigade_flatten' + LibSuff12;
+
+(*
 /**
  * Creates a pool-allocated string representing a flat bucket brigade
  * @param bb The bucket brigade to create the char array from
Index: packages/httpd24/src/http_config.inc
===================================================================
--- packages/httpd24/src/http_config.inc	(revision 26570)
+++ packages/httpd24/src/http_config.inc	(working copy)
@@ -119,6 +119,14 @@
 
 //#if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN)
 
+  tnoargsfunc   = function(parms: Pcmd_parms; mconfig: pointer): Pchar; cdecl;
+  trawargsfunc  = function(parms: Pcmd_parms; mconfig: pointer; args: Pchar): Pchar; cdecl;
+  ttakeargvfunc = function(parms: Pcmd_parms; mconfig: pointer; argc: longint; argv: PPchar): Pchar; cdecl;
+  ttake1func    = function(parms: Pcmd_parms; mconfig: pointer; w: Pchar): Pchar; cdecl;
+  ttake2func    = function(parms: Pcmd_parms; mconfig: pointer; w, w2: Pchar): Pchar; cdecl;
+  ttake3func    = function(parms: Pcmd_parms; mconfig: pointer; w, w2, w3: Pchar): Pchar; cdecl;
+  tflagfunc     = function(parms: Pcmd_parms; mconfig: pointer; on_: longint): Pchar; cdecl;
+
 {**
  * All the types of functions that can be used in directives
  * @internal
@@ -126,25 +134,25 @@
   cmd_func = record
      case longint of
        {** function to call for a no-args *}
-       0 : ( no_args : function (parms:Pcmd_parms; mconfig:pointer):Pchar;cdecl; );
+       0 : ( no_args : tnoargsfunc);
 
        {** function to call for a raw-args *}
-       1 : ( raw_args : function (parms:Pcmd_parms; mconfig:pointer; args:Pchar):Pchar;cdecl; );
+       1 : ( raw_args : trawargsfunc);
 
        {** function to call for a argv/argc *}
-       2 : ( take_argv : function (parms:Pcmd_parms; mconfig:pointer; argc:longint; argv:PPchar):Pchar;cdecl; );
+       2 : ( take_argv : ttakeargvfunc);
 
        {** function to call for a take1 *}
-       3 : ( take1 : function (parms:Pcmd_parms; mconfig:pointer; w:Pchar):Pchar;cdecl; );
+       3 : ( take1 : ttake1func);
 
        {** function to call for a take2 *}
-       4 : ( take2 : function (parms:Pcmd_parms; mconfig:pointer; w:Pchar; w2:Pchar):Pchar;cdecl; );
+       4 : ( take2 : ttake2func);
 
        {** function to call for a take3 *}
-       5 : ( take3 : function (parms:Pcmd_parms; mconfig:pointer; w:Pchar; w2:Pchar; w3:Pchar):Pchar;cdecl; );
+       5 : ( take3 : ttake3func);
 
        {** function to call for a flag *}
-       6 : ( flag : function (parms:Pcmd_parms; mconfig:pointer; on_:longint):Pchar;cdecl; );
+       6 : ( flag : tflagfunc);
      end;
   Pcmd_func = ^cmd_func;
 (*
Index: packages/httpd24/src/httpd24.pas
===================================================================
--- packages/httpd24/src/httpd24.pas	(revision 26570)
+++ packages/httpd24/src/httpd24.pas	(working copy)
@@ -43,6 +43,7 @@
  * @
   }
 unit httpd24;
+
 {$ifdef fpc}
   {$mode delphi}{$H+}
 {$endif}
@@ -50,6 +51,8 @@
   {$PACKRECORDS C}
 {$endif}
 
+{$PACKENUM 4}
+
 {$IFDEF Apache1_3}
   {$WARNING Apache1_3 is defined somewhere, but the HTTPD unit included is for Apache2_4}
 {$ENDIF}
@@ -158,11 +161,101 @@
 //{$include http_connection.inc}
 //{$include http_vhost.inc}
 
-//{$include util_script.inc}
+{$include util_script.inc}
 //{$include util_time.inc}
 //{$include util_md5.inc}
 //{$include ap_mpm.inc}
 
+// APRUtil External Variables //
+
+var
+
+  {/* All of the bucket types implemented by the core */
+  /**
+   * The flush bucket type.  This signifies that all data should be flushed to
+   * the next filter.  The flush bucket should be sent with the other buckets.
+   */}
+  apr_bucket_type_flush: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The EOS bucket type.  This signifies that there will be no more data, ever.
+   * All filters MUST send all data to the next filter when they receive a
+   * bucket of this type
+   */}
+  apr_bucket_type_eos: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The FILE bucket type.  This bucket represents a file on disk
+   */}
+  apr_bucket_type_file: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The HEAP bucket type.  This bucket represents a data allocated from the
+   * heap.
+   */}
+  apr_bucket_type_heap: apr_bucket_type_t external LibAPRUtil;
+  {$IFDEF APR_HAS_MMAP}
+    {/**
+     * The MMAP bucket type.  This bucket represents an MMAP'ed file
+     */}
+    apr_bucket_type_mmap: apr_bucket_type_t external LibAPRUtil;
+  {$ENDIF}
+  {/**
+   * The POOL bucket type.  This bucket represents a data that was allocated
+   * from a pool.  IF this bucket is still available when the pool is cleared,
+   * the data is copied on to the heap.
+   */}
+  apr_bucket_type_pool: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The PIPE bucket type.  This bucket represents a pipe to another program.
+   */}
+  apr_bucket_type_pipe: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The IMMORTAL bucket type.  This bucket represents a segment of data that
+   * the creator is willing to take responsibility for.  The core will do
+   * nothing with the data in an immortal bucket
+   */}
+  apr_bucket_type_immortal: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The TRANSIENT bucket type.  This bucket represents a data allocated off
+   * the stack.  When the setaside function is called, this data is copied on
+   * to the heap
+   */}
+  apr_bucket_type_transient: apr_bucket_type_t external LibAPRUtil;
+  {/**
+   * The SOCKET bucket type.  This bucket represents a socket to another machine
+   */}
+  apr_bucket_type_socket: apr_bucket_type_t external LibAPRUtil;
+
+//********************************************************************
+  { from apr_buckets.inc }
+
+  function APR_BRIGADE_SENTINEL(b: Papr_bucket_brigade): Papr_bucket;
+  function APR_BRIGADE_FIRST(b: Papr_bucket_brigade): Papr_bucket;
+  function APR_BRIGADE_LAST(b: Papr_bucket_brigade): Papr_bucket;
+  function APR_BUCKET_NEXT(e: Papr_bucket): Papr_bucket;
+  function APR_BUCKET_PREV(e: Papr_bucket): Papr_bucket;
+  procedure APR_BUCKET_REMOVE(e: Papr_bucket);
+  function APR_BUCKET_IS_METADATA(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_FLUSH(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_EOS(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_FILE(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_PIPE(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_SOCKET(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_HEAP(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_TRANSIENT(e: Papr_bucket): boolean;
+  function APR_BUCKET_IS_IMMORTAL(e: Papr_bucket): boolean;
+  {$IFDEF APR_HAS_MMAP}
+    function APR_BUCKET_IS_MMAP(e: Papr_bucket): boolean;
+  {$ENDIF}
+  function APR_BUCKET_IS_POOL(e: Papr_bucket): boolean;
+  function apr_bucket_read(e: Papr_bucket; const str: PPChar; len: Papr_size_t;
+    block: apr_read_type_e): apr_status_t;
+
+  function AP_INIT_TAKE1(directive: Pchar; const take1func : ttake1func;
+    mconfig: Pointer; where: Integer; help: Pchar): command_rec;
+  function AP_INIT_TAKE2(directive: Pchar; const take2func: ttake2func;
+    mconfig: Pointer; where: Integer; help: Pchar): command_rec;
+  function AP_INIT_TAKE3(directive: Pchar; const take3func: ttake3func;
+    mconfig: Pointer; where: Integer; help: Pchar): command_rec;
+
 implementation
   { Internal representation for a HTTP protocol number, e.g., HTTP/1.1 }
   function HTTP_VERSION(major, minor: Integer): Integer;
@@ -245,6 +338,146 @@
   end;
 
 //********************************************************************
+  { from apr_buckets.inc }
+
+  function APR_BRIGADE_FIRST(b: Papr_bucket_brigade): Papr_bucket; inline;
+  begin
+    APR_BRIGADE_FIRST := b^.list.next;
+  end;
+
+  function APR_BRIGADE_LAST(b: Papr_bucket_brigade): Papr_bucket; inline;
+  begin
+    APR_BRIGADE_LAST := b^.list.prev;
+  end;
+
+  function APR_BRIGADE_SENTINEL(b: Papr_bucket_brigade): Papr_bucket; inline;
+  var b_: apr_bucket; // This should technically be <type> and link shouldn't be hard-coded..
+  begin
+    APR_BRIGADE_SENTINEL := Papr_bucket(pointer(@b^.list.next) - (pointer(@b_.Link) - pointer(@b_) ) );
+  end;
+
+  function APR_BUCKET_IS_METADATA(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_METADATA := e^.type_^.is_metadata = APR_BUCKET_METADATA;
+  end;
+
+  function APR_BUCKET_IS_FLUSH(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_FLUSH := e^.type_ = @apr_bucket_type_flush;
+  end;
+
+  function APR_BUCKET_IS_EOS(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_EOS := e^.type_ = @apr_bucket_type_eos;
+  end;
+
+  function APR_BUCKET_IS_FILE(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_FILE := e^.type_ = @apr_bucket_type_file;
+  end;
+
+  function APR_BUCKET_IS_PIPE(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_PIPE := e^.type_ = @apr_bucket_type_pipe;
+  end;
+
+  function APR_BUCKET_IS_SOCKET(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_SOCKET := e^.type_ = @apr_bucket_type_socket;
+  end;
+
+  function APR_BUCKET_IS_HEAP(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_HEAP := e^.type_ = @apr_bucket_type_heap;
+  end;
+
+  function APR_BUCKET_IS_TRANSIENT(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_TRANSIENT := e^.type_ = @apr_bucket_type_transient;
+  end;
+
+  function APR_BUCKET_IS_IMMORTAL(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_IMMORTAL := e^.type_ = @apr_bucket_type_immortal;
+  end;
+
+  {$IFDEF APR_HAS_MMAP}
+    function APR_BUCKET_IS_MMAP(e: Papr_bucket): boolean; inline;
+    begin
+      APR_BUCKET_IS_MMAP := e^.type_ = @apr_bucket_type_mmap;
+    end;
+  {$ENDIF}
+
+  function APR_BUCKET_IS_POOL(e: Papr_bucket): boolean; inline;
+  begin
+    APR_BUCKET_IS_POOL := e^.type_ = @apr_bucket_type_pool;
+  end;
+
+  function APR_BUCKET_NEXT(e: Papr_bucket): Papr_bucket; inline;
+  begin
+    APR_BUCKET_NEXT := e^.link.next;
+  end;
+
+  function APR_BUCKET_PREV(e: Papr_bucket): Papr_bucket; inline;
+  begin
+    APR_BUCKET_PREV := e^.link.prev;
+  end;
+
+  procedure APR_BUCKET_REMOVE(e: Papr_bucket); inline;
+  begin
+    APR_BUCKET_PREV(e)^.link.next := APR_BUCKET_NEXT(e);
+    APR_BUCKET_NEXT(e)^.link.prev := APR_BUCKET_PREV(e);
+  end;
+
+  function apr_bucket_read(e: Papr_bucket; const str: PPChar; len: Papr_size_t;
+    block: apr_read_type_e): apr_status_t; inline;
+  begin
+    apr_bucket_read := e^.type_^.read(e, str, len, block);
+  end;
+
+  function AP_INIT_TAKE1(directive: Pchar; const take1func: ttake1func;
+    mconfig: Pointer; where: Integer; help: Pchar): command_rec; inline;
+  begin
+    with result DO
+    begin
+      name         := directive;
+      func.take1   := take1func;
+      cmd_data     := mconfig;
+      req_override := where;
+      args_how     := TAKE1;
+      errmsg       := help;
+    end;
+  end;
+
+  function AP_INIT_TAKE2(directive: Pchar; const take2func: ttake2func;
+    mconfig: Pointer; where: Integer; help: Pchar): command_rec; inline;
+  begin
+    with result DO
+    begin
+      name         := directive;
+      func.take2   := take2func;
+      cmd_data     := mconfig;
+      req_override := where;
+      args_how     := TAKE2;
+      errmsg       := help;
+    end;
+  end;
+
+  function AP_INIT_TAKE3(directive: Pchar; const take3func: ttake3func;
+    mconfig: Pointer; where: Integer; help: Pchar): command_rec; inline;
+  begin
+    with result DO
+    begin
+      name         := directive;
+      func.take3   := take3func;
+      cmd_data     := mconfig;
+      req_override := where;
+      args_how     := TAKE3;
+      errmsg       := help;
+    end;
+  end;
+
+//********************************************************************
   { from http_config.inc }
 
   { Use this in all standard modules }
Index: packages/httpd24/src/util_filter.inc
===================================================================
--- packages/httpd24/src/util_filter.inc	(revision 26570)
+++ packages/httpd24/src/util_filter.inc	(working copy)
@@ -135,15 +135,15 @@
  * @
   }
   ap_out_filter_func = function (f: Pap_filter_t;
-                                 b: Papr_bucket_brigade):apr_status_t;
+                                 b: Papr_bucket_brigade):apr_status_t; cdecl;
 
   ap_in_filter_func = function (f: Pap_filter_t; 
                                 b: Papr_bucket_brigade;
                                 mode: ap_input_mode_t;
                                 block: apr_read_type_e;
-                                readbytes: apr_off_t): apr_status_t;
+                                readbytes: apr_off_t): apr_status_t; cdecl;
 
-  ap_init_filter_func = function (f: Pap_filter_t): Longint;
+  ap_init_filter_func = function (f: Pap_filter_t): Longint; cdecl;
 
   Pap_filter_func = ^ap_filter_func;
   ap_filter_func = record
Index: packages/httpd24/src/util_script.inc
===================================================================
--- packages/httpd24/src/util_script.inc	(revision 0)
+++ packages/httpd24/src/util_script.inc	(working copy)
@@ -0,0 +1,242 @@
+(*
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file  util_script.h
+ * @brief Apache script tools
+ *
+ * @defgroup APACHE_CORE_SCRIPT Script Tools
+ * @ingroup  APACHE_CORE
+ * @{
+ */
+
+#ifndef APACHE_UTIL_SCRIPT_H
+#define APACHE_UTIL_SCRIPT_H
+
+#include "apr_buckets.h"
+#include "ap_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef APACHE_ARG_MAX
+#ifdef _POSIX_ARG_MAX
+#define APACHE_ARG_MAX _POSIX_ARG_MAX
+#else
+#define APACHE_ARG_MAX 512
+#endif
+#endif
+*)
+{
+/**
+ * Create an environment variable out of an Apache table of key-value pairs
+ * @param p pool to allocate out of
+ * @param t Apache table of key-value pairs
+ * @return An array containing the same key-value pairs suitable for
+ *         use with an exec call.
+ * @fn char **ap_create_environment(apr_pool_t *p, apr_table_t *t)
+ */
+AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t);
+
+/**
+ * This "cute" little function comes about because the path info on
+ * filenames and URLs aren't always the same. So we take the two,
+ * and find as much of the two that match as possible.
+ * @param uri The uri we are currently parsing
+ * @param path_info The current path info
+ * @return The length of the path info
+ * @fn int ap_find_path_info(const char *uri, const char *path_info)
+ */
+AP_DECLARE(int) ap_find_path_info(const char *uri, const char *path_info);
+
+/**
+ * Add CGI environment variables required by HTTP/1.1 to the request's
+ * environment table
+ * @param r the current request
+ * @fn void ap_add_cgi_vars(request_rec *r)
+ */
+AP_DECLARE(void) ap_add_cgi_vars(request_rec *r);
+
+/**
+ * Add common CGI environment variables to the requests environment table
+ * @param r The current request
+ * @fn void ap_add_common_vars(request_rec *r)
+ */
+AP_DECLARE(void) ap_add_common_vars(request_rec *r);
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param f The file to read from
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ * @fn int ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer)
+ */
+AP_DECLARE(int) ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer);
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param f The file to read from
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param module_index The module index to be used for logging
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE(int) ap_scan_script_header_err_ex(request_rec *r, apr_file_t *f,
+                                             char *buffer, int module_index);
+
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param bb The brigade from which to read
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ * @fn int ap_scan_script_header_err_brigade(request_rec *r, apr_bucket_brigade *bb, char *buffer)
+ */
+AP_DECLARE(int) ap_scan_script_header_err_brigade(request_rec *r,
+                                                  apr_bucket_brigade *bb,
+                                                  char *buffer);
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param bb The brigade from which to read
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param module_index The module index to be used for logging
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE(int) ap_scan_script_header_err_brigade_ex(request_rec *r,
+                                                     apr_bucket_brigade *bb,
+                                                     char *buffer,
+                                                     int module_index);
+
+/**
+ * Read headers strings from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param termch Pointer to the last character parsed.
+ * @param termarg Pointer to an int to capture the last argument parsed.
+ *
+ * The varargs are string arguments to parse consecutively for headers,
+ * with a NULL argument to terminate the list.
+ *
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r,
+                                                      char *buffer,
+                                                      const char **termch,
+                                                      int *termarg, ...)
+                       AP_FN_ATTR_SENTINEL;
+
+/**
+ * Read headers strings from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param module_index The module index to be used for logging
+ * @param termch Pointer to the last character parsed.
+ * @param termarg Pointer to an int to capture the last argument parsed.
+ *
+ * The varargs are string arguments to parse consecutively for headers,
+ * with a NULL argument to terminate the list.
+ *
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs_ex(request_rec *r,
+                                                         char *buffer,
+                                                         int module_index,
+                                                         const char **termch,
+                                                         int *termarg, ...)
+                       AP_FN_ATTR_SENTINEL;
+
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param getsfunc Function to read the headers from.  This function should
+                   act like gets()
+ * @param getsfunc_data The place to read from
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE(int) ap_scan_script_header_err_core(request_rec *r, char *buffer,
+                                               int (*getsfunc) (char *, int, void *),
+                                               void *getsfunc_data);
+
+/**
+ * Read headers output from a script, ensuring that the output is valid.  If
+ * the output is valid, then the headers are added to the headers out of the
+ * current request
+ * @param r The current request
+ * @param buffer Empty when calling the function.  On output, if there was an
+ *               error, the string that cause the error is stored here.
+ * @param getsfunc Function to read the headers from.  This function should
+                   act like gets()
+ * @param getsfunc_data The place to read from
+ * @param module_index The module index to be used for logging
+ * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
+ */
+AP_DECLARE(int) ap_scan_script_header_err_core_ex(request_rec *r, char *buffer,
+                                        int (*getsfunc) (char *, int, void *),
+                                        void *getsfunc_data, int module_index);
+}
+
+{/**
+ * Parse query args for the request and store in a new table allocated
+ * from the request pool.
+ * For args with no value, "1" will be used instead.
+ * If no query args were specified, the table will be empty.
+ * @param r The current request
+ * @param table A new table on output.
+ */
+AP_DECLARE(void) ap_args_to_table(request_rec *r, apr_table_t **table);}
+
+procedure ap_args_to_table(r: Prequest_rec; table: PPapr_table_t);
+  {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
+  external LibHTTPD Name LibNamePrefix + 'ap_args_to_table' + LibSuff8;
+
+(*
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* !APACHE_UTIL_SCRIPT_H */
+/** @} */
+*)
+
httpd24-2.diff (30,578 bytes)   

Dennis Fehr

2014-01-24 04:39

reporter   ~0072623

I managed to login again! Yay! So, this is the new patch for Httpd24 (Apache 2.4, implementing Config options, and some more AP_* macros).

Michael Van Canneyt

2014-01-24 11:45

administrator   ~0072628

Applied the patch, thank you.

Issue History

Date Modified Username Field Change
2014-01-14 21:06 Dennis Fehr New Issue
2014-01-14 21:06 Dennis Fehr File Added: httpd24.diff
2014-01-14 21:08 Jonas Maebe Assigned To => Michael Van Canneyt
2014-01-14 21:08 Jonas Maebe Status new => assigned
2014-01-24 04:37 Dennis Fehr File Added: httpd24-2.diff
2014-01-24 04:39 Dennis Fehr Note Added: 0072623
2014-01-24 11:45 Michael Van Canneyt Fixed in Revision => 26573
2014-01-24 11:45 Michael Van Canneyt Note Added: 0072628
2014-01-24 11:45 Michael Van Canneyt Status assigned => resolved
2014-01-24 11:45 Michael Van Canneyt Fixed in Version => 2.7.1
2014-01-24 11:45 Michael Van Canneyt Resolution open => fixed
2014-01-24 11:45 Michael Van Canneyt Target Version => 2.8.0