github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/apache_2_2_34/include/util_script.h (about)

     1  /* Licensed to the Apache Software Foundation (ASF) under one or more
     2   * contributor license agreements.  See the NOTICE file distributed with
     3   * this work for additional information regarding copyright ownership.
     4   * The ASF licenses this file to You under the Apache License, Version 2.0
     5   * (the "License"); you may not use this file except in compliance with
     6   * the License.  You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  /**
    18   * @file  util_script.h
    19   * @brief Apache script tools
    20   *
    21   * @defgroup APACHE_CORE_SCRIPT Script Tools
    22   * @ingroup  APACHE_CORE
    23   * @{
    24   */
    25  
    26  #ifndef APACHE_UTIL_SCRIPT_H
    27  #define APACHE_UTIL_SCRIPT_H
    28  
    29  #include "apr_buckets.h"
    30  
    31  #ifdef __cplusplus
    32  extern "C" {
    33  #endif
    34  
    35  #ifndef APACHE_ARG_MAX
    36  #ifdef _POSIX_ARG_MAX
    37  #define APACHE_ARG_MAX _POSIX_ARG_MAX
    38  #else
    39  #define APACHE_ARG_MAX 512
    40  #endif
    41  #endif
    42  
    43  /**
    44   * Create an environment variable out of an Apache table of key-value pairs
    45   * @param p pool to allocate out of
    46   * @param t Apache table of key-value pairs
    47   * @return An array containing the same key-value pairs suitable for
    48   *         use with an exec call.
    49   * @deffunc char **ap_create_environment(apr_pool_t *p, apr_table_t *t)
    50   */
    51  AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t);
    52  
    53  /**
    54   * This "cute" little function comes about because the path info on
    55   * filenames and URLs aren't always the same. So we take the two,
    56   * and find as much of the two that match as possible.
    57   * @param uri The uri we are currently parsing
    58   * @param path_info The current path info
    59   * @return The length of the path info
    60   * @deffunc int ap_find_path_info(const char *uri, const char *path_info)
    61   */
    62  AP_DECLARE(int) ap_find_path_info(const char *uri, const char *path_info);
    63  
    64  /**
    65   * Add CGI environment variables required by HTTP/1.1 to the request's 
    66   * environment table
    67   * @param r the current request
    68   * @deffunc void ap_add_cgi_vars(request_rec *r)
    69   */
    70  AP_DECLARE(void) ap_add_cgi_vars(request_rec *r);
    71  
    72  /**
    73   * Add common CGI environment variables to the requests environment table
    74   * @param r The current request
    75   * @deffunc void ap_add_common_vars(request_rec *r)
    76   */
    77  AP_DECLARE(void) ap_add_common_vars(request_rec *r);
    78  
    79  /**
    80   * Read headers output from a script, ensuring that the output is valid.  If
    81   * the output is valid, then the headers are added to the headers out of the
    82   * current request
    83   * @param r The current request
    84   * @param f The file to read from
    85   * @param buffer Empty when calling the function.  On output, if there was an
    86   *               error, the string that cause the error is stored here. 
    87   * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
    88   * @deffunc int ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer)
    89   */ 
    90  AP_DECLARE(int) ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer);
    91  
    92  /**
    93   * Read headers output from a script, ensuring that the output is valid.  If
    94   * the output is valid, then the headers are added to the headers out of the
    95   * current request
    96   * @param r The current request
    97   * @param bb The brigade from which to read
    98   * @param buffer Empty when calling the function.  On output, if there was an
    99   *               error, the string that cause the error is stored here. 
   100   * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
   101   * @deffunc int ap_scan_script_header_err_brigade(request_rec *r, apr_bucket_brigade *bb, char *buffer)
   102   */ 
   103  AP_DECLARE(int) ap_scan_script_header_err_brigade(request_rec *r,
   104                                                    apr_bucket_brigade *bb,
   105                                                    char *buffer);
   106  
   107  /**
   108   * Read headers strings from a script, ensuring that the output is valid.  If
   109   * the output is valid, then the headers are added to the headers out of the
   110   * current request
   111   * @param r The current request
   112   * @param buffer Empty when calling the function.  On output, if there was an
   113   *               error, the string that cause the error is stored here. 
   114   * @param termch Pointer to the last character parsed.
   115   * @param termarg Pointer to an int to capture the last argument parsed.
   116   * @param args   String arguments to parse consecutively for headers, 
   117   *               a NULL argument terminates the list.
   118   * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
   119   * @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data)
   120   */ 
   121  AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r, 
   122                                                        char *buffer, 
   123                                                        const char **termch,
   124                                                        int *termarg, ...);
   125  
   126  /**
   127   * Read headers output from a script, ensuring that the output is valid.  If
   128   * the output is valid, then the headers are added to the headers out of the
   129   * current request
   130   * @param r The current request
   131   * @param buffer Empty when calling the function.  On output, if there was an
   132   *               error, the string that cause the error is stored here. 
   133   * @param getsfunc Function to read the headers from.  This function should
   134                     act like gets()
   135   * @param getsfunc_data The place to read from
   136   * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise
   137   * @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data)
   138   */ 
   139  AP_DECLARE(int) ap_scan_script_header_err_core(request_rec *r, char *buffer,
   140  				       int (*getsfunc) (char *, int, void *),
   141  				       void *getsfunc_data);
   142  
   143  #ifdef __cplusplus
   144  }
   145  #endif
   146  
   147  #endif	/* !APACHE_UTIL_SCRIPT_H */
   148  /** @} */