Commit 450813c7 authored by Stefan Fritsch's avatar Stefan Fritsch
Browse files

Add more (trace) logging to the ap_scan_script_header*() functions

Add ap_scan_script_header*_ex() functions that take a module index for
logging.
Make mod_cgi, mod_cgid, mod_proxy_fcgi, mod_proxy_scgi, mod_isapi use the
new functions.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1147493 13f79535-47bb-0310-9956-ffa450edef68
parent 7af731b2
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2,6 +2,13 @@

Changes with Apache 2.3.14

  *) core: Add more logging to ap_scan_script_header_err* functions. Add
     ap_scan_script_header_err*_ex functions that take a module index for
     logging.
     mod_cgi, mod_cgid, mod_proxy_fcgi, mod_proxy_scgi, mod_isapi: Use the
     new functions in order to make logging configurable per-module.
     [Stefan Fritsch]

  *) mod_dir: Add DirectoryIndexRedirect to send an external redirect to
     the proper index.  [Eric Covener]

+3 −2
Original line number Diff line number Diff line
@@ -337,9 +337,10 @@
 *                         add ap_start_lingering_close(),
 *                         add conn_state_e:CONN_STATE_LINGER_NORMAL and CONN_STATE_LINGER_SHORT
 * 20110619.1 (2.3.13-dev) add ap_str_toupper()
 * 20110702.0 (2.3.13-dev) make ap_expr_parse_cmd() macro wrapper for new
 * 20110702.0 (2.3.14-dev) make ap_expr_parse_cmd() macro wrapper for new
 *                         ap_expr_parse_cmd_mi() function, add ap_expr_str_*() functions,
 *                         rename AP_EXPR_FLAGS_* -> AP_EXPR_FLAG_*
 * 20110702.1 (2.3.14-dev) Add ap_scan_script_header_err*_ex functions
 */

#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
@@ -347,7 +348,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20110702
#endif
#define MODULE_MAGIC_NUMBER_MINOR 0                    /* 0...n */
#define MODULE_MAGIC_NUMBER_MINOR 1                    /* 0...n */

/**
 * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
+73 −0
Original line number Diff line number Diff line
@@ -90,6 +90,21 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r);
 */ 
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
@@ -105,6 +120,22 @@ 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
@@ -126,6 +157,30 @@ AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r,
                                                      int *termarg, ...)
                       ap_func_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_func_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
@@ -142,6 +197,24 @@ 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.
+4 −4
Original line number Diff line number Diff line
@@ -714,12 +714,12 @@ static apr_ssize_t send_response_header(isapi_cid *cid,
    old_status = cid->r->status;

    if (stat) {
        res = ap_scan_script_header_err_strs(cid->r, NULL, &termch, &termarg,
                stat, head, NULL);
        res = ap_scan_script_header_err_strs_ex(cid->r, NULL,
                APLOG_MODULE_INDEX, &termch, &termarg, stat, head, NULL);
    }
    else {
        res = ap_scan_script_header_err_strs(cid->r, NULL, &termch, &termarg,
                head, NULL);
        res = ap_scan_script_header_err_strs_ex(cid->r, NULL,
                APLOG_MODULE_INDEX, &termch, &termarg, head, NULL);
    }

    /* Set our status. */
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ static int asis_handler(request_rec *r)
        return HTTP_FORBIDDEN;
    }

    ap_scan_script_header_err(r, f, NULL);
    ap_scan_script_header_err_ex(r, f, NULL, APLOG_MODULE_INDEX);
    location = apr_table_get(r->headers_out, "Location");

    if (location && location[0] == '/' &&
Loading