/packages/httpd22/src/util_script.inc
Pascal | 140 lines | 31 code | 13 blank | 96 comment | 0 complexity | e806f8014038ab1f0ae4c20a9754e25a MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
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//#include "apr_buckets.h" 18 19{ 20 * @package Apache script tools 21 } 22 23const 24 APACHE_ARG_MAX = 512; 25 26{ 27 * Create an environment variable out of an Apache table of key-value pairs 28 * @param p pool to allocate out of 29 * @param t Apache table of key-value pairs 30 * @return An array containing the same key-value pairs suitable for 31 * use with an exec call. 32 * @deffunc char **ap_create_environment(apr_pool_t *p, apr_table_t *t) 33 } 34function ap_create_environment(p: Papr_pool_t; t: Papr_table_t): PPChar; 35 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 36 external LibHTTPD name LibNamePrefix + 'ap_create_environment' + LibSuff8; 37 38{ 39 * This "cute" little function comes about because the path info on 40 * filenames and URLs aren't always the same. So we take the two, 41 * and find as much of the two that match as possible. 42 * @param uri The uri we are currently parsing 43 * @param path_info The current path info 44 * @return The length of the path info 45 * @deffunc int ap_find_path_info(const char *uri, const char *path_info) 46 } 47function ap_find_path_info(const uri, path_info: PChar): Integer; 48 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 49 external LibHTTPD name LibNamePrefix + 'ap_find_path_info' + LibSuff8; 50 51{ 52 * Add CGI environment variables required by HTTP/1.1 to the request's 53 * environment table 54 * @param r the current request 55 * @deffunc void ap_add_cgi_vars(request_rec *r) 56 } 57procedure ap_add_cgi_vars(r: Prequest_rec); 58 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 59 external LibHTTPD name LibNamePrefix + 'ap_add_cgi_vars' + LibSuff4; 60 61{ 62 * Add common CGI environment variables to the requests environment table 63 * @param r The current request 64 * @deffunc void ap_add_common_vars(request_rec *r) 65 } 66procedure ap_add_common_vars(r: Prequest_rec); 67 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 68 external LibHTTPD name LibNamePrefix + 'ap_add_common_vars' + LibSuff4; 69 70{ 71 * Read headers output from a script, ensuring that the output is valid. If 72 * the output is valid, then the headers are added to the headers out of the 73 * current request 74 * @param r The current request 75 * @param f The file to read from 76 * @param buffer Empty when calling the function. On output, if there was an 77 * error, the string that cause the error is stored here. 78 * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise 79 * @deffunc int ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer) 80 } 81function ap_scan_script_header_err(r: Prequest_rec; 82 f: Papr_file_t; buffer: PChar): Integer; 83 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 84 external LibHTTPD name LibNamePrefix + 'ap_scan_script_header_err' + LibSuff12; 85 86{ 87 * Read headers output from a script, ensuring that the output is valid. If 88 * the output is valid, then the headers are added to the headers out of the 89 * current request 90 * @param r The current request 91 * @param bb The brigade from which to read 92 * @param buffer Empty when calling the function. On output, if there was an 93 * error, the string that cause the error is stored here. 94 * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise 95 * @deffunc int ap_scan_script_header_err_brigade(request_rec *r, apr_bucket_brigade *bb, char *buffer) 96 } 97function ap_scan_script_header_err_brigade(r: Prequest_rec; 98 bb: Papr_bucket_brigade; buffer: PChar): Integer; 99 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 100 external LibHTTPD name LibNamePrefix + 'ap_scan_script_header_err_brigade' + LibSuff12; 101 102{ 103 * Read headers strings from a script, ensuring that the output is valid. If 104 * the output is valid, then the headers are added to the headers out of the 105 * current request 106 * @param r The current request 107 * @param buffer Empty when calling the function. On output, if there was an 108 * error, the string that cause the error is stored here. 109 * @param termch Pointer to the last character parsed. 110 * @param termarg Pointer to an int to capture the last argument parsed. 111 * @param args String arguments to parse consecutively for headers, 112 * a NULL argument terminates the list. 113 * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise 114 * @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data) 115 } 116function ap_scan_script_header_err_strs(buffer: PChar; 117 termch: PPChar; termarg: PInteger; others: array of const): Integer; 118 cdecl; external LibHTTPD name 'ap_scan_script_header_err_strs'; 119 120{ 121 * Read headers output from a script, ensuring that the output is valid. If 122 * the output is valid, then the headers are added to the headers out of the 123 * current request 124 * @param r The current request 125 * @param buffer Empty when calling the function. On output, if there was an 126 * error, the string that cause the error is stored here. 127 * @param getsfunc Function to read the headers from. This function should 128 act like gets() 129 * @param getsfunc_data The place to read from 130 * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise 131 * @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data) 132 } 133type 134 getsfunc_t = function(p1: PChar; p2: Integer; p3: Pointer): Integer; 135 136function ap_scan_script_header_err_core(r: Prequest_rec; 137 buffer: PChar; getsfunc: getsfunc_t; getsfunc_data: Pointer): Integer; 138 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 139 external LibHTTPD name LibNamePrefix + 'ap_scan_script_header_err_core' + LibSuff16; 140