1{ 2 Converted using the Apache 2.4.3 httpd-2.4.3 source files 3 to be used with FreePascal (fpc) 4} 5{* XXX - We need to push more stuff to other .h files, or even .c files, to 6 * make this file smaller} 7 8{ Headers in which EVERYONE has an interest... } 9{$include ap_config.inc} 10{$include ap_mmn.inc} 11{$include ap_release.inc} 12{all translated apr are included in the parent httpd.pas unit with using the apr.pas unit} 13////{$include "apr_general.inc"} 14//{$include "apr_tables.inc"} 15//{$include "apr_pools.inc"} 16////{$include "apr_time.inc"} 17////{$include "apr_network_io.inc"} 18{$include aprutil/apr_buckets.inc} 19{$include aprutil/apr_uri.inc} 20//{$include "apr_poll.inc"} 21//{$include "apr_thread_proc.inc"} 22////{$include "os.inc"} 23{$include ap_regex.inc} 24 25{ Note: apr_uri.h is also included, see below } 26 27{ ----------------------------- config dir ------------------------------ } 28{* Define this to be the default server home dir. Most things later in this 29 * file with a relative pathname will have this added. 30 } 31 32const 33{$ifdef OS2} 34 {* Set default for OS/2 file system } 35 HTTPD_ROOT = '/os2httpd'; 36{$else} 37 {$ifdef WIN32} 38 {* Set default for Windows file system } 39 HTTPD_ROOT = '/apache'; 40 {$else} 41 {$ifdef NETWARE} 42 {* Set the default for NetWare } 43 HTTPD_ROOT = '/apache'; 44 {$else} 45 {* Set for all other OSs } 46 HTTPD_ROOT = '/usr/local/apache'; 47 {$endif} 48 {$endif} 49{$endif} 50{ HTTPD_ROOT } 51 52{* --------- You shouldn't have to edit anything below this line ---------- 53 * 54 * Any modifications to any defaults not defined above should be done in the 55 * respective configuration file. 56 *} 57 58{* 59 * Default location of documents. Can be overridden by the DocumentRoot 60 * directive.} 61{$ifdef OS2} 62 { Set default for OS/2 file system } 63 DOCUMENT_LOCATION = HTTPD_ROOT + '/docs'; 64{$else} 65 { Set default for non OS/2 file system } 66 DOCUMENT_LOCATION = HTTPD_ROOT + '/htdocs'; 67{$endif} 68 69 {* Maximum number of dynamically loaded modules } 70 DYNAMIC_MODULE_LIMIT = 256; 71 72 {* Default administrator's address } 73 DEFAULT_ADMIN = '[no address given]'; 74 75 {* The name of the log files } 76 DEFAULT_ERRORLOG = 'logs/error_log'; 77 78 {* Define this to be what your per-directory security files are called } 79{$ifdef OS2} 80 { Set default for OS/2 file system } 81 DEFAULT_ACCESS_FNAME = 'htaccess'; 82{$else} 83 DEFAULT_ACCESS_FNAME = '.htaccess'; 84{$endif} 85 86 {* The name of the server config file } 87 SERVER_CONFIG_FILE = 'conf/httpd.conf'; 88 89 {* The default path for CGI scripts if none is currently set } 90 DEFAULT_PATH = '/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin'; 91 92 {* The path to the suExec wrapper, can be overridden in Configuration } 93 SUEXEC_BIN = HTTPD_ROOT + '/bin/suexec'; 94 95 {* The timeout for waiting for messages } 96 DEFAULT_TIMEOUT = 60; 97 98 {* The timeout for waiting for keepalive timeout until next request } 99 DEFAULT_KEEPALIVE_TIMEOUT = 5; 100 101 {* The number of requests to entertain per connection } 102 DEFAULT_KEEPALIVE = 100; 103 104 { 105 * Limits on the size of various request items. These limits primarily 106 * exist to prevent simple denial-of-service attacks on a server based 107 * on misuse of the protocol. The recommended values will depend on the 108 * nature of the server resources -- CGI scripts and database backends 109 * might require large values, but most servers could get by with much 110 * smaller limits than we use below. The request message body size can 111 * be limited by the per-dir config directive LimitRequestBody. 112 * 113 * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE 114 * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190. 115 * These two limits can be lowered or raised by the server config 116 * directives LimitRequestLine and LimitRequestFieldsize, respectively. 117 * 118 * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by 119 * the server config directive LimitRequestFields. 120 } 121 {* default limit on bytes in Request-Line (Method+URI+HTTP-version) } 122 DEFAULT_LIMIT_REQUEST_LINE = 8190; 123 124 {* default limit on bytes in any one header field } 125 DEFAULT_LIMIT_REQUEST_FIELDSIZE = 8190; 126 127 {* default limit on number of request header fields } 128 DEFAULT_LIMIT_REQUEST_FIELDS = 100; 129 130 {* 131 * The default default character set name to add if AddDefaultCharset is 132 * enabled. Overridden with AddDefaultCharsetName. 133 } 134 DEFAULT_ADD_DEFAULT_CHARSET_NAME = 'iso-8859-1'; 135 136 {* default HTTP Server protocol } 137 AP_SERVER_PROTOCOL = 'HTTP/1.1'; 138 139 { ------------------ stuff that modules are allowed to look at ----------- } 140 {* Define this to be what your HTML directory content files are called } 141 AP_DEFAULT_INDEX = 'index.html'; 142 143 {* The name of the MIME types file } 144 AP_TYPES_CONFIG_FILE = 'conf/mime.types'; 145 146 { 147 * Define the HTML doctype strings centrally. 148 } 149 {* HTML 2.0 Doctype } 150 DOCTYPE_HTML_2_0 = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' + LineEnding; 151 152 {* HTML 3.2 Doctype } 153 DOCTYPE_HTML_3_2 = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">' + LineEnding; 154 155 {* HTML 4.0 Strict Doctype } 156 DOCTYPE_HTML_4_0S = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"' + LineEnding + 157 'http://www.w3.org/TR/REC-html40/strict.dtd">' + LineEnding; 158 159 {* HTML 4.0 Transitional Doctype } 160 DOCTYPE_HTML_4_0T = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"' + LineEnding + 161 '"http://www.w3.org/TR/REC-html40/loose.dtd">' + LineEnding; 162 163 {* HTML 4.0 Frameset Doctype } 164 DOCTYPE_HTML_4_0F = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN"' + LineEnding + 165 '"http://www.w3.org/TR/REC-html40/frameset.dtd">' + LineEnding; 166 167 {* XHTML 1.0 Strict Doctype } 168 DOCTYPE_XHTML_1_0S = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"' + LineEnding + 169 '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' + LineEnding; 170 171 {* XHTML 1.0 Transitional Doctype } 172 DOCTYPE_XHTML_1_0T = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' + LineEnding + 173 '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + LineEnding; 174 175 {* XHTML 1.0 Frameset Doctype } 176 DOCTYPE_XHTML_1_0F = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"' + LineEnding + 177 '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">' + LineEnding; 178 179 {* Internal representation for a HTTP protocol number, e.g., HTTP/1.1 } 180 { was #define dname(params) para_def_expr } 181 { argument types are unknown } 182 { return type might be wrong } 183 function HTTP_VERSION(major,minor : Integer) : Integer; 184 185 {* Major part of HTTP protocol } 186 function HTTP_VERSION_MAJOR(number : Integer) : Integer; 187 188 {* Minor part of HTTP protocol } 189 function HTTP_VERSION_MINOR(number : Integer) : Integer; 190 191 { -------------- Port number for server running standalone --------------- } 192 const 193 {* default HTTP Port } 194 DEFAULT_HTTP_PORT = 80; 195 {* default HTTPS Port } 196 DEFAULT_HTTPS_PORT = 443; 197 {* 198 * Check whether @a port is the default port for the request @a r. 199 * @param port The port number 200 * @param r The request 201 * @see #ap_default_port 202 } 203 { was #define dname(params) para_def_expr } 204 { argument types are unknown } 205 { return type might be wrong } 206// function ap_is_default_port(port,r : longint) : longint; 207 208 {* 209 * Get the default port for a request (which depends on the scheme). 210 * @param r The request 211 } 212 { was #define dname(params) para_def_expr } 213 { argument types are unknown } 214 { return type might be wrong } 215// function ap_default_port(r : longint) : longint; 216 217 {* 218 * Get the scheme for a request. 219 * @param r The request 220 } 221 { was #define dname(params) para_def_expr } 222 { argument types are unknown } 223 { return type might be wrong } 224// function ap_http_scheme(r : longint) : longint; 225 226 const 227 {* The length of a Huge string } 228 HUGE_STRING_LEN = 8192; 229 230 {* The default string length } 231 MAX_STRING_LEN = HUGE_STRING_LEN; 232 233 {* The size of the server's internal read-write buffers } 234 AP_IOBUFSIZE = 8192; 235 236 {* The max number of regex captures that can be expanded by ap_pregsub } 237 AP_MAX_REG_MATCH = 10; 238 239 {* 240 * APR_HAS_LARGE_FILES introduces the problem of spliting sendfile into 241 * mutiple buckets, no greater than MAX(apr_size_t), and more granular 242 * than that in case the brigade code/filters attempt to read it directly. 243 * ### 16mb is an invention, no idea if it is reasonable. 244 } 245 { 2^24 } 246 AP_MAX_SENDFILE = 16777216; 247 248 {* 249 * MPM child process exit status values 250 * The MPM parent process may check the status to see if special 251 * error handling is required. 252 } 253 {* a normal exit } 254 APEXIT_OK = $0; 255 256 {* A fatal error arising during the server's init sequence } 257 APEXIT_INIT = $2; 258 259 {* The child died during its init sequence } 260 APEXIT_CHILDINIT = $3; 261 262 {* 263 * The child exited due to a resource shortage. 264 * The parent should limit the rate of forking until 265 * the situation is resolved. 266 } 267 APEXIT_CHILDSICK = $7; 268 269 {* 270 * A fatal error, resulting in the whole server aborting. 271 * If a child exits with this error, the parent process 272 * considers this a server-wide fatal error and aborts. 273 } 274 APEXIT_CHILDFATAL = $f; 275 276 {* 277 * Stuff marked #AP_DECLARE is part of the API, and intended for use 278 * by modules. Its purpose is to allow us to add attributes that 279 * particular platforms or compilers require to every exported function. 280 } 281 { was #define dname(params) para_def_expr } 282 { argument types are unknown } 283 { return type might be wrong } 284// function AP_DECLARE(_type : longint) : longint; 285 286 {* 287 * Stuff marked #AP_DECLARE_NONSTD is part of the API, and intended for 288 * use by modules. The difference between #AP_DECLARE and 289 * #AP_DECLARE_NONSTD is that the latter is required for any functions 290 * which use varargs or are used via indirect function call. This 291 * is to accomodate the two calling conventions in windows dlls. 292 } 293 { was #define dname(params) para_def_expr } 294 { argument types are unknown } 295 { return type might be wrong } 296// function AP_DECLARE_NONSTD(_type : longint) : longint; 297 298 299{$define AP_DECLARE_DATA} 300 301 { was #define dname(params) para_def_expr } 302 { argument types are unknown } 303 { return type might be wrong } 304// function AP_MODULE_DECLARE(_type : longint) : longint; 305 306 { was #define dname(params) para_def_expr } 307 { argument types are unknown } 308 { return type might be wrong } 309// function AP_MODULE_DECLARE_NONSTD(_type : longint) : longint; 310 311{$define AP_MODULE_DECLARE_DATA} 312 313 {* 314 * @internal 315 * modules should not use functions marked AP_CORE_DECLARE 316 } 317// const 318// AP_CORE_DECLARE = AP_DECLARE; 319 320 {* 321 * @internal 322 * modules should not use functions marked AP_CORE_DECLARE_NONSTD 323 } 324// const 325// AP_CORE_DECLARE_NONSTD = AP_DECLARE_NONSTD; 326 327 {* 328 * @defgroup APACHE_APR_STATUS_T HTTPD specific values of apr_status_t 329 * @ 330 } 331 332// const 333// AP_START_USERERR = APR_OS_START_USERERR+2000; 334// AP_USERERR_LEN = 1000; 335 {* The function declines to handle the request } 336// AP_DECLINED = AP_START_USERERR+0; 337 338 {* @ } 339 {* 340 * @brief The numeric version information is broken out into fields within this 341 * structure. 342 } 343 {*< major number } 344 {*< minor number } 345 {*< patch number } 346(* Const before type ignored *) 347 {*< additional string like "-dev" } 348 349 type 350 Pap_version_t = ^ap_version_t; 351 ap_version_t = record 352 major : Integer; 353 minor : Integer; 354 patch : Integer; 355 add_string : PChar; 356 end; 357 358 {* 359 * Return httpd's version information in a numeric form. 360 * 361 * @param version Pointer to a version structure for returning the version 362 * information. 363 } 364 procedure ap_get_server_revision(version: Pap_version_t); 365 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 366 external LibHTTPD name LibNamePrefix + 'ap_get_server_revision' + LibSuff4; 367 368 {* 369 * Get the server banner in a form suitable for sending over the 370 * network, with the level of information controlled by the 371 * ServerTokens directive. 372 * @return The server banner 373 } 374 function ap_get_server_banner: PChar; 375 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 376 external LibHTTPD name LibNamePrefix + 'ap_get_server_revision' + LibSuff0; 377 378 {* 379 * Get the server description in a form suitable for local displays, 380 * status reports, or logging. This includes the detailed server 381 * version and information about some modules. It is not affected 382 * by the ServerTokens directive. 383 * @return The server description 384 } 385 function ap_get_server_description: PChar; 386 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 387 external LibHTTPD name LibNamePrefix + 'ap_get_server_revision' + LibSuff0; 388 389 {* 390 * Add a component to the server description and banner strings 391 * @param pconf The pool to allocate the component from 392 * @param component The string to add 393 } 394 procedure ap_add_version_component(pconf: Papr_pool_t; const component: PChar); 395 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 396 external LibHTTPD name LibNamePrefix + 'ap_add_version_component' + LibSuff8; 397 398 {* 399 * Get the date a time that the server was built 400 * @return The server build time string 401 } 402 function ap_get_server_built: PChar; 403 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 404 external LibHTTPD name LibNamePrefix + 'ap_get_server_built' + LibSuff0; 405 406 { non-HTTP status codes returned by hooks } 407 const 408 OK = 0; {*< Module has handled this stage. } 409 DECLINED = -1; {*< Module declines to handle } 410 DONE = -2; {*< Module has served the response completely 411 * - it's safe to die() with no more output 412 } 413 SUSPENDED = -(3); {*< Module will handle the remainder of the request. 414 * The core will never invoke the request again, } 415 416 {* Returned by the bottom-most filter if no data was written. 417 * @see ap_pass_brigade(). } 418 AP_NOBODY_WROTE = -100; 419 {* Returned by the bottom-most filter if no data was read. 420 * @see ap_get_brigade(). } 421 AP_NOBODY_READ = -101; 422 {* Returned by any filter if the filter chain encounters an error 423 * and has already dealt with the error response. } 424 AP_FILTER_ERROR = -102; 425 426 {* 427 * @defgroup HTTP_Status HTTP Status Codes 428 * @ 429 } 430 {* 431 * The size of the static status_lines array in http_protocol.c for 432 * storing all of the potential response status-lines (a sparse table). 433 * When adding a new code here add it to status_lines as well. 434 * A future version should dynamically generate the apr_table_t at startup. 435 } 436 RESPONSE_CODES = 83; 437 438 HTTP_CONTINUE = 100; 439 HTTP_SWITCHING_PROTOCOLS = 101; 440 HTTP_PROCESSING = 102; 441 HTTP_OK = 200; 442 HTTP_CREATED = 201; 443 HTTP_ACCEPTED = 202; 444 HTTP_NON_AUTHORITATIVE = 203; 445 HTTP_NO_CONTENT = 204; 446 HTTP_RESET_CONTENT = 205; 447 HTTP_PARTIAL_CONTENT = 206; 448 HTTP_MULTI_STATUS = 207; 449 HTTP_ALREADY_REPORTED = 208; 450 HTTP_IM_USED = 226; 451 HTTP_MULTIPLE_CHOICES = 300; 452 HTTP_MOVED_PERMANENTLY = 301; 453 HTTP_MOVED_TEMPORARILY = 302; 454 HTTP_SEE_OTHER = 303; 455 HTTP_NOT_MODIFIED = 304; 456 HTTP_USE_PROXY = 305; 457 HTTP_TEMPORARY_REDIRECT = 307; 458 HTTP_PERMANENT_REDIRECT = 308; 459 HTTP_BAD_REQUEST = 400; 460 HTTP_UNAUTHORIZED = 401; 461 HTTP_PAYMENT_REQUIRED = 402; 462 HTTP_FORBIDDEN = 403; 463 HTTP_NOT_FOUND = 404; 464 HTTP_METHOD_NOT_ALLOWED = 405; 465 HTTP_NOT_ACCEPTABLE = 406; 466 HTTP_PROXY_AUTHENTICATION_REQUIRED = 407; 467 HTTP_REQUEST_TIME_OUT = 408; 468 HTTP_CONFLICT = 409; 469 HTTP_GONE = 410; 470 HTTP_LENGTH_REQUIRED = 411; 471 HTTP_PRECONDITION_FAILED = 412; 472 HTTP_REQUEST_ENTITY_TOO_LARGE = 413; 473 HTTP_REQUEST_URI_TOO_LARGE = 414; 474 HTTP_UNSUPPORTED_MEDIA_TYPE = 415; 475 HTTP_RANGE_NOT_SATISFIABLE = 416; 476 HTTP_EXPECTATION_FAILED = 417; 477 HTTP_UNPROCESSABLE_ENTITY = 422; 478 HTTP_LOCKED = 423; 479 HTTP_FAILED_DEPENDENCY = 424; 480 HTTP_UPGRADE_REQUIRED = 426; 481 HTTP_PRECONDITION_REQUIRED = 428; 482 HTTP_TOO_MANY_REQUESTS = 429; 483 HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; 484 HTTP_INTERNAL_SERVER_ERROR = 500; 485 HTTP_NOT_IMPLEMENTED = 501; 486 HTTP_BAD_GATEWAY = 502; 487 HTTP_SERVICE_UNAVAILABLE = 503; 488 HTTP_GATEWAY_TIME_OUT = 504; 489 HTTP_VERSION_NOT_SUPPORTED = 505; 490 HTTP_VARIANT_ALSO_VARIES = 506; 491 HTTP_INSUFFICIENT_STORAGE = 507; 492 HTTP_LOOP_DETECTED = 508; 493 HTTP_NOT_EXTENDED = 510; 494 HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; 495 496 {* is the status code informational } 497 function ap_is_HTTP_INFO(x : Integer): Boolean; 498 499 {* is the status code OK ? } 500 { was #define dname(params) para_def_expr } 501 { argument types are unknown } 502 { return type might be wrong } 503 function ap_is_HTTP_SUCCESS(x : Integer): Boolean; 504 505 {* is the status code a redirect } 506 { was #define dname(params) para_def_expr } 507 { argument types are unknown } 508 { return type might be wrong } 509 function ap_is_HTTP_REDIRECT(x : Integer): Boolean; 510 511 {* is the status code a error (client or server) } 512 { was #define dname(params) para_def_expr } 513 { argument types are unknown } 514 { return type might be wrong } 515 function ap_is_HTTP_ERROR(x : Integer): Boolean; 516 517 {* is the status code a client error } 518 { was #define dname(params) para_def_expr } 519 { argument types are unknown } 520 { return type might be wrong } 521 function ap_is_HTTP_CLIENT_ERROR(x : Integer): Boolean; 522 523 {* is the status code a server error } 524 { was #define dname(params) para_def_expr } 525 { argument types are unknown } 526 { return type might be wrong } 527 function ap_is_HTTP_SERVER_ERROR(x : Integer): Boolean; 528 529 {* is the status code a (potentially) valid response code? } 530 { was #define dname(params) para_def_expr } 531 { argument types are unknown } 532 { return type might be wrong } 533 function ap_is_HTTP_VALID_RESPONSE(x : Integer): Boolean; 534 535 {* should the status code drop the connection } 536 function ap_status_drops_connection(x : Integer): Boolean; 537 538 {* @ } 539 {* 540 * @defgroup Methods List of Methods recognized by the server 541 * @ingroup APACHE_CORE_DAEMON 542 * @ 543 * 544 * @brief Methods recognized (but not necessarily handled) by the server. 545 * 546 * These constants are used in bit shifting masks of size int, so it is 547 * unsafe to have more methods than bits in an int. HEAD == M_GET. 548 * This list must be tracked by the list in http_protocol.c in routine 549 * ap_method_name_of(). 550 * 551 } 552 const 553 M_GET = 0; {* RFC 2616: HTTP } 554 M_PUT = 1; { : } 555 M_POST = 2; 556 M_DELETE = 3; 557 M_CONNECT = 4; 558 M_OPTIONS = 5; 559 M_TRACE = 6; {* RFC 2616: HTTP } 560 M_PATCH = 7; {* no rfc(!) ### remove this one? } 561 M_PROPFIND = 8; {* RFC 2518: WebDAV } 562 M_PROPPATCH = 9; { : } 563 M_MKCOL = 10; 564 M_COPY = 11; 565 M_MOVE = 12; 566 M_LOCK = 13; 567 M_UNLOCK = 14; {* RFC 2518: WebDAV } 568 M_VERSION_CONTROL = 15; {* RFC 3253: WebDAV Versioning } 569 M_CHECKOUT = 16; { : } 570 M_UNCHECKOUT = 17; 571 M_CHECKIN = 18; 572 M_UPDATE = 19; 573 M_LABEL = 20; 574 M_REPORT = 21; 575 M_MKWORKSPACE = 22; 576 M_MKACTIVITY = 23; 577 M_BASELINE_CONTROL = 24; 578 M_MERGE = 25; 579 M_INVALID = 26; {* no valid method } 580 581 {* 582 * METHODS needs to be equal to the number of bits 583 * we are using for limit masks. 584 } 585 METHODS = 64; 586 {* 587 * The method mask bit to shift for anding with a bitmask. 588 } 589 590 { was #define dname def_expr } 591 AP_METHOD_BIT = apr_int64_t(1); 592 593 {* @see ap_method_list_t } 594 type 595 {* 596 * @struct ap_method_list_t 597 * @brief Structure for handling HTTP methods. 598 * 599 * Methods known to the server are accessed via a bitmask shortcut; 600 * extension methods are handled by an array. 601 } 602 Pap_method_list_t = ^ap_method_list_t; 603 ap_method_list_t = record 604 {* The bitmask used for known methods } 605 method_mask : apr_int64_t; 606 {* the array used for extension methods } 607 method_list : Papr_array_header_t; 608 end; 609 610 {* 611 * @defgroup module_magic Module Magic mime types 612 * @ 613 } 614 const 615 {* Magic for mod_cgi[d] } 616 CGI_MAGIC_TYPE = 'application/x-httpd-cgi'; 617 {* Magic for mod_include } 618 INCLUDES_MAGIC_TYPE = 'text/x-server-parsed-html'; 619 {* Magic for mod_include } 620 INCLUDES_MAGIC_TYPE3 = 'text/x-server-parsed-html3'; 621 {* Magic for mod_dir } 622 DIR_MAGIC_TYPE = 'httpd/unix-directory'; 623 {* @ } 624 625 { Just in case your linefeed isn't the one the other end is expecting. } 626 const 627 {* linefeed } 628 LF = 10; 629 {* carrige return } 630 CR = 13; 631 {* carrige return /Line Feed Combo } 632 CRLF = #015#012; 633 634 {* 635 * @defgroup values_request_rec_body Possible values for request_rec.read_body 636 * @ 637 * Possible values for request_rec.read_body (set by handling module): 638 } 639 {* Send 413 error if message has any body } 640 REQUEST_NO_BODY = 0; 641 {* Send 411 error if body without Content-Length } 642 REQUEST_CHUNKED_ERROR = 1; 643 {* If chunked, remove the chunks for me. } 644 REQUEST_CHUNKED_DECHUNK = 2; 645 646 {* @ // values_request_rec_body } 647 {* 648 * @defgroup values_request_rec_used_path_info Possible values for request_rec.used_path_info 649 * @ingroup APACHE_CORE_DAEMON 650 * @ 651 * Possible values for request_rec.used_path_info: 652 } 653 {* Accept the path_info from the request } 654 AP_REQ_ACCEPT_PATH_INFO = 0; 655 {* Return a 404 error if path_info was given } 656 AP_REQ_REJECT_PATH_INFO = 1; 657 {* Module may chose to use the given path_info } 658 AP_REQ_DEFAULT_PATH_INFO = 2; 659 660 {* @ // values_request_rec_used_path_info } 661 { 662 * Things which may vary per file-lookup WITHIN a request --- 663 * e.g., state of MIME config. Basically, the name of an object, info 664 * about the object, and any other info we may ahve which may need to 665 * change as we go poking around looking for it (e.g., overridden by 666 * .htaccess files). 667 * 668 * Note how the default state of almost all these things is properly 669 * zero, so that allocating it with pcalloc does the right thing without 670 * a whole lot of hairy initialization... so long as we are willing to 671 * make the (fairly) portable assumption that the bit pattern of a NULL 672 * pointer is, in fact, zero. 673 } 674 {* 675 * @brief This represents the result of calling htaccess; these are cached for 676 * each request. 677 } 678 type 679 Phtaccess_result = ^htaccess_result; 680 htaccess_result = record 681 {* the directory to which this applies } 682 dir : Pchar; 683 {* the overrides allowed for the .htaccess file } 684 override : Integer; 685 {* the override options allowed for the .htaccess file } 686 override_opts : Integer; 687 {* Table of allowed directives for override } 688 override_list : Papr_table_t; 689 {* the configuration directives } 690 htaccess : Pap_conf_vector_t; 691 {* the next one, or NULL if no more; N.B. never change this } 692 next : Phtaccess_result; 693 end; 694 695 { The following four types define a hierarchy of activities, so that 696 * given a request_rec r you can write r->connection->server->process 697 * to get to the process_rec. While this reduces substantially the 698 * number of arguments that various hooks require beware that in 699 * threaded versions of the server you must consider multiplexing 700 * issues. } 701 702//{$include "apr_uri.inc"} 703 704 type 705 {* 706 * @brief A structure that represents one process 707 } 708 Pprocess_rec = ^process_rec; 709 process_rec = record 710 {* Global pool. Cleared upon normal exit } 711 pool : Papr_pool_t; 712 {* Configuration pool. Cleared upon restart } 713 pconf : Papr_pool_t; 714 {* The program name used to execute the program } 715 short_name : PChar; 716 {* The command line arguments } 717 argv : PChar; 718 {* Number of command line arguments passed to the program } 719 argc : Integer; 720 end; 721 722 {* 723 * @struct server_addr_rec 724 * @brief A structure to be used for Per-vhost config 725 } 726 type 727 Pserver_addr_rec = ^server_addr_rec; 728 server_addr_rec = record 729{* The next server in the list } 730 next : Pserver_addr_rec; 731{* The name given in "<VirtualHost>" } 732 virthost : Pchar; 733{* The bound address, for this server } 734 host_addr : Papr_sockaddr_t; 735{* The bound port, for this server } 736 host_port : apr_port_t; 737 end; 738 739 Pap_logconf = ^ap_logconf; 740 ap_logconf = record 741{* The per-module log levels } 742 module_levels : ^char; 743{* The log level for this server } 744 level : longint; 745 end; 746 747{* 748 * @brief A structure to store information for each virtual server 749 } 750 PPserver_rec = ^Pserver_rec; 751 Pserver_rec = ^server_rec; 752 server_rec = record 753{* The process this server is running in } 754 process : Pprocess_rec; 755{* The next server in the list } 756 next : Pserver_rec; 757 758{ Log files --- note that transfer log is now in the modules... } 759 760{* The name of the error log } 761 error_fname : Pchar; 762{* A file descriptor that references the error log } 763 error_log : Papr_file_t; 764{* The log level configuration } 765 log : ap_logconf; 766 767{ Module-specific configuration for server, and defaults... } 768 769{* Config vector containing pointers to modules' per-server config 770 * structures. } 771 module_config : Pap_conf_vector_t; 772{* MIME type info, etc., before we start checking per-directory info } 773 lookup_defaults : Pap_conf_vector_t; 774{* The name of the server } 775 defn_name : Pchar; 776{* The line of the config file that the server was defined on } 777 defn_line_number : dword; 778{* true if this is the virtual server } 779 is_virtual : char; 780 781{ Information for redirects } 782 783{* for redirects, etc. } 784 port : apr_port_t; 785{* The server request scheme for redirect responses } 786 server_scheme : Pchar; 787 788{ Contact information } 789 790{* The admin's contact information } 791 server_admin : Pchar; 792{* The server hostname } 793 server_hostname : Pchar; 794 795{ Transaction handling } 796 797{* I haven't got a clue } 798 addrs : Pserver_addr_rec; 799{* Timeout, as an apr interval, before we give up } 800 timeout : apr_interval_time_t; 801{* The apr interval we will wait for another request } 802 keep_alive_timeout : apr_interval_time_t; 803{* Maximum requests per connection } 804 keep_alive_max : Integer; 805{* Use persistent connections? } 806 keep_alive : Integer; 807 808{* Normal names for ServerAlias servers } 809 names : Papr_array_header_t; 810{* Wildcarded names for ServerAlias servers } 811 wild_names : Papr_array_header_t; 812 813{* Pathname for ServerPath } 814 path : Pchar; 815{* Length of path } 816 pathlen : Integer; 817 818{* limit on size of the HTTP request line } 819 limit_req_line : Integer; 820{* limit on size of any request header field } 821 limit_req_fieldsize : Integer; 822{* limit on number of request header fields } 823 limit_req_fields : Integer; 824 825{* Opaque storage location } 826 context : pointer; 827 end; 828 829 830 {* 831 * @brief Structure to store things which are per connection 832 } 833 type 834 ap_conn_keepalive_e = (AP_CONN_UNKNOWN,AP_CONN_CLOSE,AP_CONN_KEEPALIVE); 835 836 {* 837 * Enumeration of connection states 838 * The two states CONN_STATE_LINGER_NORMAL and CONN_STATE_LINGER_SHORT may 839 * only be set by the MPM. Use CONN_STATE_LINGER outside of the MPM.} 840 conn_state_e = ( 841 CONN_STATE_CHECK_REQUEST_LINE_READABLE, 842 CONN_STATE_READ_REQUEST_LINE, 843 CONN_STATE_HANDLER, 844 CONN_STATE_WRITE_COMPLETION, 845 CONN_STATE_SUSPENDED, 846 CONN_STATE_LINGER, { connection may be closed with lingering } 847 CONN_STATE_LINGER_NORMAL, { MPM has started lingering close with normal timeout } 848 CONN_STATE_LINGER_SHORT); { MPM has started lingering close with short timeout } 849 850 {* 851 * @brief A structure to contain connection state information} 852 Pconn_state_t = ^conn_state_t; 853 conn_state_t = record 854 {* Current state of the connection } 855 state : conn_state_e; 856 end; 857 858 Pconn_rec = ^conn_rec; 859 conn_rec = record 860 {* Pool associated with this connection } 861 pool : Papr_pool_t; 862 {* Physical vhost this conn came in on } 863 base_server : Pserver_rec; 864 {* used by http_vhost.c } 865 vhost_lookup_data : pointer; 866 { Information about the connection itself } 867 {* local address } 868 local_addr : Papr_sockaddr_t; 869 {* remote address; this is the end-point of the next hop, for the address 870 * of the request creator, see useragent_addr in request_rec 871 } 872 remote_addr {client_addr} : Papr_sockaddr_t; //fpc -> renamed to stay compatible with older apache versions and older fcl-web 873 {* Client's IP address; this is the end-point of the next hop, for the 874 * IP of the request creator, see useragent_ip in request_rec 875 } 876 remote_ip {client_ip} : Pchar; //fpc -> renamed to stay compatible with older apache versions and older fcl-web 877 {* Client's DNS name, if known. NULL if DNS hasn't been checked, 878 * "" if it has and no address was found. N.B. Only access this though 879 * get_remote_host() } 880 remote_host : Pchar; 881 {* Only ever set if doing rfc1413 lookups. N.B. Only access this through 882 * get_remote_logname() } 883 remote_logname : Pchar; 884 {* server IP address } 885 local_ip : Pchar; 886 {* used for ap_get_server_name when UseCanonicalName is set to DNS 887 * (ignores setting of HostnameLookups) } 888 local_host : Pchar; 889 {* ID of this connection; unique at any point in time } 890 id : clong; 891 {* Config vector containing pointers to connections per-server 892 * config structures. } 893 conn_config : Pap_conf_vector_t; 894 {* Notes on *this* connection: send note from one module to 895 * another. must remain valid for all requests on this conn } 896 notes : Papr_table_t; 897 {* A list of input filters to be used for this connection } 898 input_filters : Pap_filter_t; 899 {* A list of output filters to be used for this connection } 900 output_filters : Pap_filter_t; 901 {* handle to scoreboard information for this connection } 902 sbh : pointer; 903 {* The bucket allocator to use for all bucket/brigade creations } 904 bucket_alloc : Papr_bucket_alloc_t; 905 {* The current state of this connection; may be NULL if not used by MPM } 906 cs : Pconn_state_t; 907 {* Is there data pending in the input filters? } 908 data_in_input_filters : cint; 909 {* Is there data pending in the output filters? } 910 data_in_output_filters : cint; 911 {* Are there any filters that clogg/buffer the input stream, breaking 912 * the event mpm. 913 } 914 clogging_input_filters: cint; 915 {* have we done double-reverse DNS? -1 yes/failure, 0 not yet, 916 * 1 yes/success } 917 double_reverse: Cardinal; 918 {* Are we still talking? } 919 aborted : Cardinal; 920 {* Are we going to keep the connection alive for another request? 921 * @see ap_conn_keepalive_e } 922 keepalive : ap_conn_keepalive_e; 923 {* How many times have we used it? } 924 keepalives : Integer; 925 {* Optional connection log level configuration. May point to a server or 926 * per_dir config, i.e. must be copied before modifying } 927 log : Pap_logconf; 928 {* Id to identify this connection in error log. Set when the first 929 * error log entry for this connection is generated. 930 } 931 log_id : Pchar; 932 {* This points to the current thread being used to process this request, 933 * over the lifetime of a request, the value may change. Users of the connection 934 * record should not rely upon it staying the same between calls that invole 935 * the MPM. 936 } 937//{$if APR_HAS_THREADS} 938// current_thread : Papr_thread_t; 939//{$endif} 940 end; 941 942 {* 943 * @brief A structure that represents the current request 944 } 945 Prequest_rec = ^request_rec; 946 request_rec = record 947 {* The pool associated with the request } 948 pool : Papr_pool_t; 949 {* The connection to the client } 950 connection : Pconn_rec; 951 {* The virtual host for this request } 952 server : Pserver_rec; 953 {* Pointer to the redirected request if this is an external redirect } 954 next : Prequest_rec; 955 {* Pointer to the previous request if this is an internal redirect } 956 prev : Prequest_rec; 957 {* Pointer to the main request if this is a sub-request (see http_request.h) } 958 main : Prequest_rec; 959 960 { Info about the request itself... we begin with stuff that only protocol.c should ever touch... } 961 {* First line of request } 962 the_request : Pchar; 963 {* HTTP/0.9, "simple" request (e.g. GET /foo\n w/no headers) } 964 assbackwards : Integer; 965 {* A proxy request (calculated during post_read_request/translate_name) 966 * possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE, 967 * PROXYREQ_RESPONSE 968 } 969 proxyreq : Integer; 970 {* HEAD request, as opposed to GET } 971 header_only : Integer; 972 {* Protocol version number of protocol; 1.1 = 1001 } 973 proto_num : Integer; 974 {* Protocol string, as given to us, or HTTP/0.9 } 975 protocol : Pchar; 976 {* Host, as set by full URI or Host: } 977 hostname : Pchar; 978 {* Time when the request started } 979 request_time : apr_time_t; 980 {* Status line, if set by script } 981 status_line : Pchar; 982 {* Status line } 983 status : Integer; 984 { Request method, two ways; also, protocol, etc.. Outside of protocol.c, 985 * look, but don't touch. 986 } 987 {* M_GET, M_POST, etc. } 988 method_number : Integer; 989 {* Request method (eg. GET, HEAD, POST, etc.) } 990 method : Pchar; 991 992 {* 993 * 'allowed' is a bitvector of the allowed methods. 994 * 995 * A handler must ensure that the request method is one that 996 * it is capable of handling. Generally modules should DECLINE 997 * any request methods they do not handle. Prior to aborting the 998 * handler like this the handler should set r->allowed to the list 999 * of methods that it is willing to handle. This bitvector is used 1000 * to construct the "Allow:" header required for OPTIONS requests, 1001 * and HTTP_METHOD_NOT_ALLOWED and HTTP_NOT_IMPLEMENTED status codes. 1002 * 1003 * Since the default_handler deals with OPTIONS, all modules can 1004 * usually decline to deal with OPTIONS. TRACE is always allowed, 1005 * modules don't need to set it explicitly. 1006 * 1007 * Since the default_handler will always handle a GET, a 1008 * module which does *not* implement GET should probably return 1009 * HTTP_METHOD_NOT_ALLOWED. Unfortunately this means that a Script GET 1010 * handler can't be installed by mod_actions. 1011 } 1012 allowed : apr_int64_t; 1013 {* Array of extension methods } 1014 allowed_xmethods : Papr_array_header_t; 1015 {* List of allowed methods } 1016 allowed_methods : Pap_method_list_t; 1017 {* byte count in stream is for body } 1018 sent_bodyct : apr_off_t; 1019 {* body byte count, for easy access } 1020 bytes_sent : apr_off_t; 1021 {* Last modified time of the requested resource } 1022 mtime : apr_time_t; 1023 { HTTP/1.1 connection-level features } 1024 {* The Range: header } 1025 range : Pchar; 1026 {* The "real" content length } 1027 clength : apr_off_t; 1028 {* sending chunked transfer-coding } 1029 chunked : Integer; 1030 {* Method for reading the request body 1031 * (eg. REQUEST_CHUNKED_ERROR, REQUEST_NO_BODY, 1032 * REQUEST_CHUNKED_DECHUNK, etc...) } 1033 read_body : Integer; 1034 {* reading chunked transfer-coding } 1035 read_chunked : Integer; 1036 {* is client waiting for a 100 response? } 1037 expecting_100 : Cardinal; 1038 {* The optional kept body of the request. } 1039 kept_body : Papr_bucket_brigade; 1040 {* For ap_body_to_table(): parsed body } 1041 { XXX: ap_body_to_table has been removed. Remove body_table too or 1042 * XXX: keep it to reintroduce ap_body_to_table without major bump? } 1043 body_table : Papr_table_t; 1044 {* Remaining bytes left to read from the request body } 1045 remaining : apr_off_t; 1046 {* Number of bytes that have been read from the request body } 1047 read_length : apr_off_t; 1048 1049 { MIME header environments, in and out. Also, an array containing 1050 * environment variables to be passed to subprocesses, so people can 1051 * write modules to add to that environment. 1052 * 1053 * The difference between headers_out and err_headers_out is that the 1054 * latter are printed even on error, and persist across internal redirects 1055 * (so the headers printed for ErrorDocument handlers will have them). 1056 * 1057 * The 'notes' apr_table_t is for notes from one module to another, with no 1058 * other set purpose in mind... 1059 } 1060 {* MIME header environment from the request } 1061 headers_in : Papr_table_t; 1062 {* MIME header environment for the response } 1063 headers_out : Papr_table_t; 1064 {* MIME header environment for the response, printed even on errors and 1065 * persist across internal redirects } 1066 err_headers_out : Papr_table_t; 1067 {* Array of environment variables to be used for sub processes } 1068 subprocess_env : Papr_table_t; 1069 {* Notes from one module to another } 1070 notes : Papr_table_t; 1071 1072 { content_type, handler, content_encoding, and all content_languages 1073 * MUST be lowercased strings. They may be pointers to static strings; 1074 * they should not be modified in place. 1075 } 1076 {* The content-type for the current request } 1077 content_type : Pchar; { Break these out --- we dispatch on 'em } 1078 {* The handler string that we use to call a handler function } 1079 handler : Pchar; { What we *really* dispatch on } 1080 {* How to encode the data } 1081 content_encoding : Pchar; 1082 {* Array of strings representing the content languages } 1083 content_languages : Papr_array_header_t; 1084 {* variant list validator (if negotiated) } 1085 vlist_validator : Pchar; 1086 {* If an authentication check was made, this gets set to the user name. } 1087 user : Pchar; 1088 {* If an authentication check was made, this gets set to the auth type. } 1089 ap_auth_type : Pchar; 1090 1091 { What object is being requested (either directly, or via include 1092 * or content-negotiation mapping). 1093 } 1094 {* The URI without any parsing performed } 1095 unparsed_uri : Pchar; 1096 {* The path portion of the URI, or "/" if no path provided } 1097 uri : Pchar; 1098 {* The filename on disk corresponding to this response } 1099 filename : Pchar; 1100 { XXX: What does this mean? Please define "canonicalize" -aaron } 1101 {* The true filename, we canonicalize r->filename if these don't match } 1102 canonical_filename : Pchar; 1103 {* The PATH_INFO extracted from this request } 1104 path_info : Pchar; 1105 {* The QUERY_ARGS extracted from this request } 1106 args : Pchar; 1107 1108 {* 1109 * Flag for the handler to accept or reject path_info on 1110 * the current request. All modules should respect the 1111 * AP_REQ_ACCEPT_PATH_INFO and AP_REQ_REJECT_PATH_INFO 1112 * values, while AP_REQ_DEFAULT_PATH_INFO indicates they 1113 * may follow existing conventions. This is set to the 1114 * user's preference upon HOOK_VERY_FIRST of the fixups. 1115 } 1116 used_path_info : Integer; 1117 {* A flag to determine if the eos bucket has been sent yet } 1118 eos_sent : Integer; 1119 1120 { Various other config info which may change with .htaccess files 1121 * These are config vectors, with one void* pointer for each module 1122 * (the thing pointed to being the module's business). 1123 } 1124 {* Options set in config files, etc. } 1125 per_dir_config : Pap_conf_vector_t; 1126 {* Notes on *this* request } 1127 request_config : Pap_conf_vector_t; 1128 {* Optional request log level configuration. Will usually point 1129 * to a server or per_dir config, i.e. must be copied before 1130 * modifying } 1131 log : Pap_logconf; 1132 {* Id to identify request in access and error log. Set when the first 1133 * error log entry for this request is generated. 1134 } 1135 log_id : Pchar; 1136 {* 1137 * A linked list of the .htaccess configuration directives 1138 * accessed by this request. 1139 * N.B. always add to the head of the list, _never_ to the end. 1140 * that way, a sub request's list can (temporarily) point to a parent's list 1141 } 1142 htaccess : Phtaccess_result; 1143 {* A list of output filters to be used for this request } 1144 output_filters : Pap_filter_t; 1145 {* A list of input filters to be used for this request } 1146 input_filters : Pap_filter_t; 1147 {* A list of protocol level output filters to be used for this 1148 * request } 1149 proto_output_filters : Pap_filter_t; 1150 {* A list of protocol level input filters to be used for this 1151 * request } 1152 proto_input_filters : Pap_filter_t; 1153 {* This response can not be cached } 1154 no_cache : Integer; 1155 {* There is no local copy of this response } 1156 no_local_copy : Integer; 1157 {* Mutex protect callbacks registered with ap_mpm_register_timed_callback 1158 * from being run before the original handler finishes running 1159 } 1160 invoke_mtx : Papr_thread_mutex_t; 1161 {* A struct containing the components of URI } 1162 parsed_uri : apr_uri_t; 1163 {* finfo.protection (st_mode) set to zero if no such file } 1164 finfo : apr_finfo_t; 1165 {* remote address information from conn_rec, can be overridden if 1166 * necessary by a module. 1167 * This is the address that originated the request. 1168 } 1169 useragent_addr : Papr_sockaddr_t; 1170 useragent_ip : Pchar; 1171 end; 1172 1173 {* 1174 * @defgroup ProxyReq Proxy request types 1175 * 1176 * Possible values of request_rec->proxyreq. A request could be normal, 1177 * proxied or reverse proxied. Normally proxied and reverse proxied are 1178 * grouped together as just "proxied", but sometimes it's necessary to 1179 * tell the difference between the two, such as for authentication. 1180 * @ 1181 } 1182 1183 1184 const 1185 PROXYREQ_NONE = 0;{*< No proxy } 1186 PROXYREQ_PROXY = 1;{*< Standard proxy } 1187 PROXYREQ_REVERSE = 2;{*< Reverse proxy } 1188 PROXYREQ_RESPONSE = 3;{*< Origin response } 1189 { @ } 1190 1191 {* 1192 * @brief Enumeration of connection keepalive options 1193 } 1194// type {moved up} 1195// ap_conn_keepalive_e = (AP_CONN_UNKNOWN,AP_CONN_CLOSE,AP_CONN_KEEPALIVE); 1196 1197 { Per-vhost config... } 1198 {* 1199 * The address 255.255.255.255, when used as a virtualhost address, 1200 * will become the "default" server when the ip doesn't match other vhosts. 1201 } 1202 const 1203 DEFAULT_VHOST_ADDR = $ffffffff; 1204 1205 {* 1206 * Get the context_document_root for a request. This is a generalization of 1207 * the document root, which is too limited in the presence of mappers like 1208 * mod_userdir and mod_alias. The context_document_root is the directory 1209 * on disk that maps to the context_prefix URI prefix. 1210 * @param r The request 1211 * @note For resources that do not map to the file system or for very complex 1212 * mappings, this information may still be wrong. 1213 } 1214function ap_context_document_root(r: Prequest_rec): PChar; 1215 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1216 external LibHTTPD name LibNamePrefix + 'ap_context_document_root' + LibSuff4; 1217 1218 {* 1219 * Get the context_prefix for a request. The context_prefix URI prefix 1220 * maps to the context_document_root on disk. 1221 * @param r The request 1222 } 1223function ap_context_prefix(r: Prequest_rec): PChar; 1224 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1225 external LibHTTPD name LibNamePrefix + 'ap_context_prefix' + LibSuff4; 1226 1227 {* Set context_prefix and context_document_root for a request. 1228 * @param r The request 1229 * @param prefix the URI prefix, without trailing slash 1230 * @param document_root the corresponding directory on disk, without trailing 1231 * slash 1232 * @note If one of prefix of document_root is NULL, the corrsponding 1233 * property will not be changed. 1234 } 1235procedure ap_set_context_info(r: Prequest_rec; const prefix, document_root: PChar); 1236 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1237 external LibHTTPD name LibNamePrefix + 'ap_set_context_info' + LibSuff12; 1238 1239 {* Set per-request document root. This is for mass virtual hosting modules 1240 * that want to provide the correct DOCUMENT_ROOT value to scripts. 1241 * @param r The request 1242 * @param document_root the document root for the request. 1243 } 1244procedure ap_set_document_root(r: Prequest_rec; const document_root: PChar); 1245 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1246 external LibHTTPD name LibNamePrefix + 'ap_set_document_root' + LibSuff8; 1247 1248 {* 1249 * Examine a field value (such as a media-/content-type) string and return 1250 * it sans any parameters; e.g., strip off any ';charset=foo' and the like. 1251 * @param p Pool to allocate memory from 1252 * @param intype The field to examine 1253 * @return A copy of the field minus any parameters 1254 } 1255function ap_field_noparam(p: Papr_pool_t; const intype: PChar): PChar; 1256 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1257 external LibHTTPD name LibNamePrefix + 'ap_field_noparam' + LibSuff8; 1258 1259 {* 1260 * Convert a time from an integer into a string in a specified format 1261 * @param p The pool to allocate memory from 1262 * @param t The time to convert 1263 * @param fmt The format to use for the conversion 1264 * @param gmt Convert the time for GMT? 1265 * @return The string that represents the specified time 1266 } 1267function ap_ht_time(p: Papr_pool_t; t: apr_time_t; const fmt: PChar; gmt: Integer): PChar; 1268 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1269 external LibHTTPD name LibNamePrefix + 'ap_ht_time' + LibSuff20; 1270 1271 1272 { String handling. The *_nc variants allow you to use non-const char **s as 1273 arguments (unfortunately C won't automatically convert a char ** to a const 1274 char **) } 1275 {* 1276 * Get the characters until the first occurance of a specified character 1277 * @param p The pool to allocate memory from 1278 * @param line The string to get the characters from 1279 * @param stop The character to stop at 1280 * @return A copy of the characters up to the first stop character 1281 } 1282function ap_getword(p: Papr_pool_t; const line: PPChar; stop: Char): PChar; 1283 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1284 external LibHTTPD name LibNamePrefix + 'ap_getword' + LibSuff12; 1285 1286 {* 1287 * Get the characters until the first occurance of a specified character 1288 * @param p The pool to allocate memory from 1289 * @param line The string to get the characters from 1290 * @param stop The character to stop at 1291 * @return A copy of the characters up to the first stop character 1292 * @note This is the same as ap_getword(), except it doesn't use const char **. 1293 } 1294function ap_getword_nc(p: Papr_pool_t; line: PPChar; stop: Char): PChar; 1295 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1296 external LibHTTPD name LibNamePrefix + 'ap_getword_nc' + LibSuff12; 1297 1298 {* 1299 * Get the first word from a given string. A word is defined as all characters 1300 * up to the first whitespace. 1301 * @param p The pool to allocate memory from 1302 * @param line The string to traverse 1303 * @return The first word in the line 1304 } 1305function ap_getword_white(p: Papr_pool_t; const line: PPChar): PChar; 1306 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1307 external LibHTTPD name LibNamePrefix + 'ap_getword_white' + LibSuff8; 1308 1309 {* 1310 * Get the first word from a given string. A word is defined as all characters 1311 * up to the first whitespace. 1312 * @param p The pool to allocate memory from 1313 * @param line The string to traverse 1314 * @return The first word in the line 1315 * @note The same as ap_getword_white(), except it doesn't use const char** 1316 } 1317function ap_getword_white_nc(p: Papr_pool_t; line: PPChar): PChar; 1318 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1319 external LibHTTPD name LibNamePrefix + 'ap_getword_white_nc' + LibSuff8; 1320 1321 {* 1322 * Get all characters from the first occurance of @a stop to the first "\0" 1323 * @param p The pool to allocate memory from 1324 * @param line The line to traverse 1325 * @param stop The character to start at 1326 * @return A copy of all caracters after the first occurance of the specified 1327 * character 1328 } 1329function ap_getword_nulls(p: Papr_pool_t; const line: PPChar; stop: Char): PChar; 1330 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1331 external LibHTTPD name LibNamePrefix + 'ap_getword_nulls' + LibSuff12; 1332 1333 {* 1334 * Get all characters from the first occurance of @a stop to the first "\0" 1335 * @param p The pool to allocate memory from 1336 * @param line The line to traverse 1337 * @param stop The character to start at 1338 * @return A copy of all caracters after the first occurance of the specified 1339 * character 1340 * @note The same as ap_getword_nulls(), except it doesn't use const char **. 1341 } 1342function ap_getword_nulls_nc(p: Papr_pool_t; line: PPChar; stop: Char): PChar; 1343 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1344 external LibHTTPD name LibNamePrefix + 'ap_getword_nulls_nc' + LibSuff12; 1345 1346 {* 1347 * Get the second word in the string paying attention to quoting 1348 * @param p The pool to allocate from 1349 * @param line The line to traverse 1350 * @return A copy of the string 1351 } 1352function ap_getword_conf(p: Papr_pool_t; const line: PPChar): PChar; 1353 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1354 external LibHTTPD name LibNamePrefix + 'ap_getword_conf' + LibSuff8; 1355 1356 {* 1357 * Get the second word in the string paying attention to quoting 1358 * @param p The pool to allocate from 1359 * @param line The line to traverse 1360 * @return A copy of the string 1361 * @note The same as ap_getword_conf(), except it doesn't use const char **. 1362 } 1363function ap_getword_conf_nc(p: Papr_pool_t; line: PPChar): PChar; 1364 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1365 external LibHTTPD name LibNamePrefix + 'ap_getword_conf_nc' + LibSuff8; 1366 1367 {* 1368 * Check a string for any config define or environment variable construct 1369 * and replace each of them by the value of that variable, if it exists. 1370 * The default syntax of the constructs is $ENV but can be changed by 1371 * setting the define::* config defines. If the variable does not exist, 1372 * leave the $ENV construct alone but print a warning. 1373 * @param p The pool to allocate from 1374 * @param word The string to check 1375 * @return The string with the replaced environment variables 1376 } 1377//AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word); 1378function ap_resolve_env(p: Papr_pool_t; const word_: PChar): PChar; 1379 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1380 external LibHTTPD name LibNamePrefix + 'ap_resolve_env' + LibSuff8; 1381 1382 {* 1383 * Size an HTTP header field list item, as separated by a comma. 1384 * @param field The field to size 1385 * @param len The length of the field 1386 * @return The return value is a pointer to the beginning of the non-empty 1387 * list item within the original string (or NULL if there is none) and the 1388 * address of field is shifted to the next non-comma, non-whitespace 1389 * character. len is the length of the item excluding any beginning whitespace. 1390 } 1391//AP_DECLARE(const char *) ap_size_list_item(const char **field, int *len); 1392function ap_size_list_item(const field: PPChar; len: PInteger): PChar; 1393 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1394 external LibHTTPD name LibNamePrefix + 'ap_size_list_item' + LibSuff8; 1395 1396 {* 1397 * Retrieve an HTTP header field list item, as separated by a comma, 1398 * while stripping insignificant whitespace and lowercasing anything not in 1399 * a quoted string or comment. 1400 * @param p The pool to allocate from 1401 * @param field The field to retrieve 1402 * @return The return value is a new string containing the converted list 1403 * item (or NULL if none) and the address pointed to by field is 1404 * shifted to the next non-comma, non-whitespace. 1405 } 1406function ap_get_list_item(p: Papr_pool_t; const field: PPChar): PChar; 1407 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1408 external LibHTTPD name LibNamePrefix + 'ap_get_list_item' + LibSuff8; 1409 1410 {* 1411 * Find an item in canonical form (lowercase, no extra spaces) within 1412 * an HTTP field value list. 1413 * @param p The pool to allocate from 1414 * @param line The field value list to search 1415 * @param tok The token to search for 1416 * @return 1 if found, 0 if not found. 1417 } 1418function ap_find_list_item(p: Papr_pool_t; const line, tok: PChar): Integer; 1419 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1420 external LibHTTPD name LibNamePrefix + 'ap_find_list_item' + LibSuff12; 1421 1422 {* 1423 * Retrieve a token, spacing over it and adjusting the pointer to 1424 * the first non-white byte afterwards. Note that these tokens 1425 * are delimited by semis and commas and can also be delimited 1426 * by whitespace at the caller's option. 1427 * @param p The pool to allocate from 1428 * @param accept_line The line to retrieve the token from (adjusted afterwards) 1429 * @param accept_white Is it delimited by whitespace 1430 * @return the token 1431 } 1432function ap_get_token(p: Papr_pool_t; const accept_line: PPChar; accept_white: Integer): PChar; 1433 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1434 external LibHTTPD name LibNamePrefix + 'ap_get_token' + LibSuff12; 1435 1436 {* 1437 * Find http tokens, see the definition of token from RFC2068 1438 * @param p The pool to allocate from 1439 * @param line The line to find the token 1440 * @param tok The token to find 1441 * @return 1 if the token is found, 0 otherwise 1442 } 1443function ap_find_token(p: Papr_pool_t; const line, tok: PChar): Integer; 1444 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1445 external LibHTTPD name LibNamePrefix + 'ap_find_token' + LibSuff12; 1446 1447 {* 1448 * find http tokens from the end of the line 1449 * @param p The pool to allocate from 1450 * @param line The line to find the token 1451 * @param tok The token to find 1452 * @return 1 if the token is found, 0 otherwise 1453 } 1454function ap_find_last_token(p: Papr_pool_t; const line, tok: PChar): Integer; 1455 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1456 external LibHTTPD name LibNamePrefix + 'ap_find_last_token' + LibSuff12; 1457 1458 {* 1459 * Check for an Absolute URI syntax 1460 * @param u The string to check 1461 * @return 1 if URI, 0 otherwise 1462 } 1463function ap_is_url(const u: PChar): Integer; 1464 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1465 external LibHTTPD name LibNamePrefix + 'ap_is_url' + LibSuff4; 1466 1467 {* 1468 * Unescape a string 1469 * @param url The string to unescape 1470 * @return 0 on success, non-zero otherwise 1471 } 1472function ap_unescape_all(url: PChar): Integer; 1473 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1474 external LibHTTPD name LibNamePrefix + 'ap_unescape_all' + LibSuff4; 1475 1476 {* 1477 * Unescape a URL 1478 * @param url The url to unescape 1479 * @return 0 on success, non-zero otherwise 1480 } 1481function ap_unescape_url(url: PChar): Integer; 1482 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1483 external LibHTTPD name LibNamePrefix + 'ap_unescape_url' + LibSuff4; 1484 1485 {* 1486 * Unescape a URL, but leaving %2f (slashes) escaped 1487 * @param url The url to unescape 1488 * @param decode_slashes Whether or not slashes should be decoded 1489 * @return 0 on success, non-zero otherwise 1490 } 1491function ap_unescape_url_keep2f(url: PChar; decode_slashes: Integer): Integer; 1492 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1493 external LibHTTPD name LibNamePrefix + 'ap_unescape_url_keep2f' + LibSuff8; 1494 1495 {* 1496 * Unescape an application/x-www-form-urlencoded string 1497 * @param query The query to unescape 1498 * @return 0 on success, non-zero otherwise 1499 } 1500function ap_unescape_urlencoded(query: PChar): Integer; 1501 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1502 external LibHTTPD name LibNamePrefix + 'ap_unescape_urlencoded' + LibSuff4; 1503 1504 {* 1505 * Convert all double slashes to single slashes 1506 * @param name The string to convert 1507 } 1508procedure ap_no2slash(name: PChar); 1509 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1510 external LibHTTPD name LibNamePrefix + 'ap_no2slash' + LibSuff4; 1511 1512 {* 1513 * Remove all ./ and xx/../ substrings from a file name. Also remove 1514 * any leading ../ or /../ substrings. 1515 * @param name the file name to parse 1516 } 1517procedure ap_getparents(name: PChar); 1518 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1519 external LibHTTPD name LibNamePrefix + 'ap_getparents' + LibSuff4; 1520 1521 {* 1522 * Escape a path segment, as defined in RFC 1808 1523 * @param p The pool to allocate from 1524 * @param s The path to convert 1525 * @return The converted URL 1526 } 1527function ap_escape_path_segment(p: Papr_pool_t; const s: PChar): PChar; 1528 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1529 external LibHTTPD name LibNamePrefix + 'ap_escape_path_segment' + LibSuff8; 1530 1531 {* 1532 * Escape a path segment, as defined in RFC 1808, to a preallocated buffer. 1533 * @param c The preallocated buffer to write to 1534 * @param s The path to convert 1535 * @return The converted URL (c) 1536 } 1537function ap_escape_path_segment_buffer(c: PChar; const s: PChar): PChar; 1538 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1539 external LibHTTPD name LibNamePrefix + 'ap_escape_path_segment_buffer' + LibSuff8; 1540 1541 {* 1542 * convert an OS path to a URL in an OS dependant way. 1543 * @param p The pool to allocate from 1544 * @param path The path to convert 1545 * @param partial if set, assume that the path will be appended to something 1546 * with a '/' in it (and thus does not prefix "./") 1547 * @return The converted URL 1548 } 1549function ap_os_escape_path(p: Papr_pool_t; const path: PChar; partial: Integer): PChar; 1550 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1551 external LibHTTPD name LibNamePrefix + 'ap_os_escape_path' + LibSuff12; 1552 1553 1554 {* @see ap_os_escape_path } 1555 { was #define dname(params) para_def_expr } 1556 { argument types are unknown } 1557 { return type might be wrong } 1558//#define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1) 1559function ap_escape_uri(ppool: Papr_pool_t; const path: PChar) : PChar; 1560 1561{* 1562 * Escape a string as application/x-www-form-urlencoded 1563 * @param p The pool to allocate from 1564 * @param s The path to convert 1565 * @return The converted URL 1566 } 1567function ap_escape_urlencoded(p: Papr_pool_t; const s: PChar): PChar; 1568 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1569 external LibHTTPD name LibNamePrefix + 'ap_escape_urlencoded' + LibSuff8; 1570 1571{* 1572 * Escape a string as application/x-www-form-urlencoded, to a preallocated buffer 1573 * @param c The preallocated buffer to write to 1574 * @param s The path to convert 1575 * @return The converted URL (c) 1576 } 1577function ap_escape_urlencoded_buffer(c: PChar; const s: PChar): PChar; 1578 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1579 external LibHTTPD name LibNamePrefix + 'ap_escape_urlencoded_buffer' + LibSuff8; 1580 1581{* 1582 * Escape an html string 1583 * @param p The pool to allocate from 1584 * @param s The html to escape 1585 * @return The escaped string 1586 } 1587//#define ap_escape_html(p,s) ap_escape_html2(p,s,0) 1588function ap_escape_html(p: Papr_pool_t; const s: PChar) : PChar; 1589 1590{* 1591 * Escape an html string 1592 * @param p The pool to allocate from 1593 * @param s The html to escape 1594 * @param toasc Whether to escape all non-ASCII chars to \&\#nnn; 1595 * @return The escaped string 1596 } 1597function ap_escape_html2(p: Papr_pool_t; const s: PChar; toasc: Integer): PChar; 1598 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1599 external LibHTTPD name LibNamePrefix + 'ap_escape_html2' + LibSuff12; 1600 1601{* 1602 * Escape a string for logging 1603 * @param p The pool to allocate from 1604 * @param str The string to escape 1605 * @return The escaped string 1606 } 1607function ap_escape_logitem(p: Papr_pool_t; const str: PChar): PChar; 1608 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1609 external LibHTTPD name LibNamePrefix + 'ap_escape_logitem' + LibSuff8; 1610 1611{* 1612 * Escape a string for logging into the error log (without a pool) 1613 * @param dest The buffer to write to 1614 * @param source The string to escape 1615 * @param buflen The buffer size for the escaped string (including "\0") 1616 * @return The len of the escaped string (always < maxlen) 1617 } 1618function ap_escape_errorlog_item(dest: PChar; const source: PChar; 1619 buflen: apr_size_t): apr_size_t; 1620 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1621 external LibHTTPD name LibNamePrefix + 'ap_escape_errorlog_item' + LibSuff12; 1622 1623{* 1624 * Construct a full hostname 1625 * @param p The pool to allocate from 1626 * @param hostname The hostname of the server 1627 * @param port The port the server is running on 1628 * @param r The current request 1629 * @return The server's hostname 1630 } 1631function ap_construct_server(p: Papr_pool_t; const hostname: PChar; 1632 port: apr_port_t; const r: Prequest_rec): PChar; 1633 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1634 external LibHTTPD name LibNamePrefix + 'ap_construct_server' + LibSuff16; 1635 1636{* 1637 * Escape a shell command 1638 * @param p The pool to allocate from 1639 * @param s The command to escape 1640 * @return The escaped shell command 1641 } 1642function ap_escape_shell_cmd(p: Papr_pool_t; const s: PChar): PChar; 1643 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1644 external LibHTTPD name LibNamePrefix + 'ap_escape_shell_cmd' + LibSuff8; 1645 1646{* 1647 * Count the number of directories in a path 1648 * @param path The path to count 1649 * @return The number of directories 1650 } 1651function ap_count_dirs(const path: PChar): Integer; 1652 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1653 external LibHTTPD name LibNamePrefix + 'ap_count_dirs' + LibSuff4; 1654 1655{* 1656 * Copy at most @a n leading directories of @a s into @a d. @a d 1657 * should be at least as large as @a s plus 1 extra byte 1658 * 1659 * @param d The location to copy to 1660 * @param s The location to copy from 1661 * @param n The number of directories to copy 1662 * @return value is the ever useful pointer to the trailing "\0" of d 1663 * @note on platforms with drive letters, n = 0 returns the "/" root, 1664 * whereas n = 1 returns the "d:/" root. On all other platforms, n = 0 1665 * returns the empty string. } 1666function ap_make_dirstr_prefix(d: PChar; const s: PChar; n: Integer): PChar; 1667 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1668 external LibHTTPD name LibNamePrefix + 'ap_make_dirstr_prefix' + LibSuff12; 1669 1670{* 1671 * Return the parent directory name (including trailing /) of the file 1672 * @a s 1673 * @param p The pool to allocate from 1674 * @param s The file to get the parent of 1675 * @return A copy of the file's parent directory 1676 } 1677function ap_make_dirstr_parent(p: Papr_pool_t; const s: PChar): PChar; 1678 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1679 external LibHTTPD name LibNamePrefix + 'ap_make_dirstr_parent' + LibSuff8; 1680 1681{* 1682 * Given a directory and filename, create a single path from them. This 1683 * function is smart enough to ensure that there is a single '/' between the 1684 * directory and file names 1685 * @param a The pool to allocate from 1686 * @param dir The directory name 1687 * @param f The filename 1688 * @return A copy of the full path 1689 * @note Never consider using this function if you are dealing with filesystem 1690 * names that need to remain canonical, unless you are merging an apr_dir_read 1691 * path and returned filename. Otherwise, the result is not canonical. 1692 } 1693function ap_make_full_path(a: Papr_pool_t; const dir, f: PChar): PChar; 1694 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1695 external LibHTTPD name LibNamePrefix + 'ap_make_full_path' + LibSuff12; 1696 1697{* 1698 * Test if the given path has an an absolute path. 1699 * @param p The pool to allocate from 1700 * @param dir The directory name 1701 * @note The converse is not necessarily true, some OS's (Win32/OS2/Netware) have 1702 * multiple forms of absolute paths. This only reports if the path is absolute 1703 * in a canonical sense. 1704 } 1705function ap_os_is_path_absolute(p: Papr_pool_t; const dir: PChar): Integer; 1706 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1707 external LibHTTPD name LibNamePrefix + 'ap_os_is_path_absolute' + LibSuff8; 1708 1709{* 1710 * Does the provided string contain wildcard characters? This is useful 1711 * for determining if the string should be passed to strcmp_match or to strcmp. 1712 * The only wildcard characters recognized are '?' and '*' 1713 * @param str The string to check 1714 * @return 1 if the string has wildcards, 0 otherwise 1715 } 1716function ap_is_matchexp(const str: PChar): Integer; 1717 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1718 external LibHTTPD name LibNamePrefix + 'ap_is_matchexp' + LibSuff4; 1719 1720{* 1721 * Determine if a string matches a patterm containing the wildcards '?' or '*' 1722 * @param str The string to check 1723 * @param expected The pattern to match against 1724 * @return 0 if the two strings match, 1 otherwise 1725 } 1726function ap_strcmp_match(const str, expected: PChar): Integer; 1727 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1728 external LibHTTPD name LibNamePrefix + 'ap_strcmp_match' + LibSuff8; 1729 1730{* 1731 * Determine if a string matches a patterm containing the wildcards '?' or '*', 1732 * ignoring case 1733 * @param str The string to check 1734 * @param expected The pattern to match against 1735 * @return 0 if the two strings match, 1 otherwise 1736 } 1737function ap_strcasecmp_match(const str, expected: PChar): Integer; 1738 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1739 external LibHTTPD name LibNamePrefix + 'ap_strcasecmp_match' + LibSuff8; 1740 1741{* 1742 * Find the first occurrence of the substring s2 in s1, regardless of case 1743 * @param s1 The string to search 1744 * @param s2 The substring to search for 1745 * @return A pointer to the beginning of the substring 1746 * @remark See apr_strmatch() for a faster alternative 1747 } 1748function ap_strcasestr(const s1, s2: PChar): PChar; 1749 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1750 external LibHTTPD name LibNamePrefix + 'ap_strcasestr' + LibSuff8; 1751 1752{* 1753 * Return a pointer to the location inside of bigstring immediately after prefix 1754 * @param bigstring The input string 1755 * @param prefix The prefix to strip away 1756 * @return A pointer relative to bigstring after prefix 1757 } 1758function ap_stripprefix(const bigstring, prefix: PChar): PChar; 1759 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1760 external LibHTTPD name LibNamePrefix + 'ap_stripprefix' + LibSuff8; 1761 1762{* 1763 * Decode a base64 encoded string into memory allocated from a pool 1764 * @param p The pool to allocate from 1765 * @param bufcoded The encoded string 1766 * @return The decoded string 1767 } 1768function ap_pbase64decode(p: Papr_pool_t; const bufcoded: PChar): PChar; 1769 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1770 external LibHTTPD name LibNamePrefix + 'ap_pbase64decode' + LibSuff8; 1771 1772{* 1773 * Encode a string into memory allocated from a pool in base 64 format 1774 * @param p The pool to allocate from 1775 * @param string The plaintext string 1776 * @return The encoded string 1777 } 1778//AP_DECLARE(char *) ap_pbase64encode(apr_pool_t *p, char *string); 1779function ap_pbase64encode(p: Papr_pool_t; string_: PChar): PChar; 1780 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1781 external LibHTTPD name LibNamePrefix + 'ap_pbase64encode' + LibSuff8; 1782 1783{* 1784 * Compile a regular expression to be used later. The regex is freed when 1785 * the pool is destroyed. 1786 * @param p The pool to allocate from 1787 * @param pattern the regular expression to compile 1788 * @param cflags The bitwise or of one or more of the following: 1789 * @li REG_EXTENDED - Use POSIX extended Regular Expressions 1790 * @li REG_ICASE - Ignore case 1791 * @li REG_NOSUB - Support for substring addressing of matches 1792 * not required 1793 * @li REG_NEWLINE - Match-any-character operators don't match new-line 1794 * @return The compiled regular expression 1795 } 1796function ap_pregcomp(p: Papr_pool_t; const pattern: PChar; cflags: Integer): Pap_regex_t; 1797 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1798 external LibHTTPD name LibNamePrefix + 'ap_pregcomp' + LibSuff12; 1799 1800{* 1801 * Free the memory associated with a compiled regular expression 1802 * @param p The pool the regex was allocated from 1803 * @param reg The regular expression to free 1804 * @note This function is only necessary if the regex should be cleaned 1805 * up before the pool 1806 } 1807procedure ap_pregfree(p: Papr_pool_t; reg: Pap_regex_t); 1808 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1809 external LibHTTPD name LibNamePrefix + 'ap_pregfree' + LibSuff8; 1810 1811{* 1812 * After performing a successful regex match, you may use this function to 1813 * perform a series of string substitutions based on subexpressions that were 1814 * matched during the call to ap_regexec. This function is limited to 1815 * result strings of 64K. Consider using ap_pregsub_ex() instead. 1816 * @param p The pool to allocate from 1817 * @param input An arbitrary string containing $1 through $9. These are 1818 * replaced with the corresponding matched sub-expressions 1819 * @param source The string that was originally matched to the regex 1820 * @param nmatch the nmatch returned from ap_pregex 1821 * @param pmatch the pmatch array returned from ap_pregex 1822 * @return The substituted string, or NULL on error 1823 } 1824//AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input, 1825// const char *source, apr_size_t nmatch, 1826// ap_regmatch_t pmatch[]); 1827function ap_pregsub(p: Papr_pool_t; const input, source: PChar; 1828 nmatch: apr_size_t; pmatch: array of ap_regmatch_t): PChar; 1829 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1830 external LibHTTPD name LibNamePrefix + 'ap_pregsub' + LibSuff20; 1831 1832{* 1833 * After performing a successful regex match, you may use this function to 1834 * perform a series of string substitutions based on subexpressions that were 1835 * matched during the call to ap_regexec 1836 * @param p The pool to allocate from 1837 * @param result where to store the result, will be set to NULL on error 1838 * @param input An arbitrary string containing $1 through $9. These are 1839 * replaced with the corresponding matched sub-expressions 1840 * @param source The string that was originally matched to the regex 1841 * @param nmatch the nmatch returned from ap_pregex 1842 * @param pmatch the pmatch array returned from ap_pregex 1843 * @param maxlen the maximum string length to return, 0 for unlimited 1844 * @return The substituted string, or NULL on error 1845 } 1846//AP_DECLARE(apr_status_t) ap_pregsub_ex(apr_pool_t *p, char **result, 1847// const char *input, const char *source, 1848// apr_size_t nmatch, 1849// ap_regmatch_t pmatch[], 1850// apr_size_t maxlen); 1851function ap_pregsub_ex(p: Papr_pool_t; result_: PPChar; const input, source: PChar; 1852 nmatch: apr_size_t; 1853 pmatch: array of ap_regmatch_t; 1854 maxlen: apr_size_t): apr_status_t; 1855 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1856 external LibHTTPD name LibNamePrefix + 'ap_pregsub_ex' + LibSuff28; 1857 1858{* 1859 * We want to downcase the type/subtype for comparison purposes 1860 * but nothing else because ;parameter=foo values are case sensitive. 1861 * @param s The content-type to convert to lowercase 1862 } 1863procedure ap_content_type_tolower(s: PChar); 1864 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1865 external LibHTTPD name LibNamePrefix + 'ap_content_type_tolower' + LibSuff4; 1866 1867{* 1868 * convert a string to all lowercase 1869 * @param s The string to convert to lowercase 1870 } 1871procedure ap_str_tolower(s: PChar); 1872 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1873 external LibHTTPD name LibNamePrefix + 'ap_str_tolower' + LibSuff4; 1874 1875{* 1876 * convert a string to all uppercase 1877 * @param s The string to convert to uppercase 1878 } 1879procedure ap_str_toupper(s: PChar); 1880 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1881 external LibHTTPD name LibNamePrefix + 'ap_str_toupper' + LibSuff4; 1882 1883{* 1884 * Search a string from left to right for the first occurrence of a 1885 * specific character 1886 * @param str The string to search 1887 * @param c The character to search for 1888 * @return The index of the first occurrence of c in str 1889 } 1890//AP_DECLARE(int) ap_ind(const char *str, char c); /* Sigh... */ 1891function ap_ind(const str: PChar; c: Char): Integer; 1892 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1893 external LibHTTPD name LibNamePrefix + 'ap_ind' + LibSuff8; 1894 1895{* 1896 * Search a string from right to left for the first occurrence of a 1897 * specific character 1898 * @param str The string to search 1899 * @param c The character to search for 1900 * @return The index of the first occurrence of c in str 1901 } 1902function ap_rind(const str: PChar; c: Char): Integer; 1903 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1904 external LibHTTPD name LibNamePrefix + 'ap_rind' + LibSuff8; 1905 1906{* 1907 * Given a string, replace any bare " with \\" . 1908 * @param p The pool to allocate memory from 1909 * @param instring The string to search for " 1910 * @return A copy of the string with escaped quotes 1911 } 1912function ap_escape_quotes(p: Papr_pool_t; const instring: PChar): PChar; 1913 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1914 external LibHTTPD name LibNamePrefix + 'ap_escape_quotes' + LibSuff8; 1915 1916{* 1917 * Given a string, append the PID deliminated by delim. 1918 * Usually used to create a pid-appended filepath name 1919 * (eg: /a/b/foo -> /a/b/foo.6726). A function, and not 1920 * a macro, to avoid unistd.h dependency 1921 * @param p The pool to allocate memory from 1922 * @param string The string to append the PID to 1923 * @param delim The string to use to deliminate the string from the PID 1924 * @return A copy of the string with the PID appended 1925 } 1926function ap_append_pid(p: Papr_pool_t; const string_, delim: PChar): PChar; 1927 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1928 external LibHTTPD name LibNamePrefix + 'ap_append_pid' + LibSuff12; 1929 1930{* 1931 * Parse a given timeout parameter string into an apr_interval_time_t value. 1932 * The unit of the time interval is given as postfix string to the numeric 1933 * string. Currently the following units are understood: 1934 * 1935 * ms : milliseconds 1936 * s : seconds 1937 * mi[n] : minutes 1938 * h : hours 1939 * 1940 * If no unit is contained in the given timeout parameter the default_time_unit 1941 * will be used instead. 1942 * @param timeout_parameter The string containing the timeout parameter. 1943 * @param timeout The timeout value to be returned. 1944 * @param default_time_unit The default time unit to use if none is specified 1945 * in timeout_parameter. 1946 * @return Status value indicating whether the parsing was successful or not. 1947 } 1948function ap_timeout_parameter_parse(const timeout_parameter: PChar; 1949 timeout: Papr_interval_time_t; 1950 const default_time_unit: PChar): apr_status_t; 1951 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1952 external LibHTTPD name LibNamePrefix + 'ap_timeout_parameter_parse' + LibSuff12; 1953 1954{* 1955 * Determine if a request has a request body or not. 1956 * 1957 * @param r the request_rec of the request 1958 * @return truth value 1959 } 1960function ap_request_has_body(r: Prequest_rec): Integer; 1961 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1962 external LibHTTPD name LibNamePrefix + 'ap_request_has_body' + LibSuff4; 1963 1964{* 1965 * Cleanup a string (mainly to be filesystem safe) 1966 * We only allow '_' and alphanumeric chars. Non-printable 1967 * map to 'x' and all others map to '_' 1968 * 1969 * @param p pool to use to allocate dest 1970 * @param src string to clean up 1971 * @param dest cleaned up, allocated string 1972 * @return Status value indicating whether the cleaning was successful or not. 1973 } 1974function ap_pstr2_alnum(p: Papr_pool_t; const src: PChar; 1975 const dest: PPChar): apr_status_t; 1976 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1977 external LibHTTPD name LibNamePrefix + 'ap_pstr2_alnum' + LibSuff12; 1978 1979{* 1980 * Cleanup a string (mainly to be filesystem safe) 1981 * We only allow '_' and alphanumeric chars. Non-printable 1982 * map to 'x' and all others map to '_' 1983 * 1984 * @param src string to clean up 1985 * @param dest cleaned up, pre-allocated string 1986 * @return Status value indicating whether the cleaning was successful or not. 1987 } 1988function ap_str2_alnum(const src: PChar; dest: PChar): apr_status_t; 1989 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 1990 external LibHTTPD name LibNamePrefix + 'ap_str2_alnum' + LibSuff8; 1991 1992{* 1993 * Structure to store the contents of an HTTP form of the type 1994 * application/x-www-form-urlencoded. 1995 * 1996 * Currently it contains the name as a char* of maximum length 1997 * HUGE_STRING_LEN, and a value in the form of a bucket brigade 1998 * of arbitrary length. 1999 } 2000(* Const before type ignored *) 2001 2002type 2003 ap_form_pair_t = record 2004 name : PChar; 2005 value : Papr_bucket_brigade; 2006 end; 2007{* 2008 * Read the body and parse any form found, which must be of the 2009 * type application/x-www-form-urlencoded. 2010 * @param r request containing POSTed form data 2011 * @param f filter 2012 * @param ptr returned array of ap_form_pair_t 2013 * @param num max num of params or -1 for unlimited 2014 * @param size max size allowed for parsed data 2015 * @return OK or HTTP error 2016 } 2017//AP_DECLARE(int) ap_parse_form_data(request_rec *r, struct ap_filter_t *f, 2018// apr_array_header_t **ptr, 2019// apr_size_t num, apr_size_t size); 2020function ap_parse_form_data(r: Prequest_rec; f: Pap_filter_t; 2021 ptr: PPapr_array_header_t; 2022 num: apr_size_t; size: apr_size_t): Integer; 2023 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 2024 external LibHTTPD name LibNamePrefix + 'ap_parse_form_data' + LibSuff20; 2025 2026{ Misc system hackery } 2027{* 2028 * Given the name of an object in the file system determine if it is a directory 2029 * @param p The pool to allocate from 2030 * @param name The name of the object to check 2031 * @return 1 if it is a directory, 0 otherwise 2032 } 2033function ap_is_rdirectory(p: Papr_pool_t; const name: PChar): Integer; 2034 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 2035 external LibHTTPD name LibNamePrefix + 'ap_is_rdirectory' + LibSuff8; 2036 2037{* 2038 * Given the name of an object in the file system determine if it is a directory - this version is symlink aware 2039 * @param p The pool to allocate from 2040 * @param name The name of the object to check 2041 * @return 1 if it is a directory, 0 otherwise 2042 } 2043function ap_is_directory(p: Papr_pool_t; const name: PChar): Integer; 2044 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 2045 external LibHTTPD name LibNamePrefix + 'ap_is_directory' + LibSuff8; 2046 2047//#ifdef _OSD_POSIX 2048//extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process); 2049//#endif /* _OSD_POSIX */ 2050//{$ifdef _OSD_POSIX} 2051//function os_init_job_environment(s:Pserver_rec; const user_name:Pchar; one_process:integer):integer;cdecl; 2052//{$endif} { _OSD_POSIX } 2053 2054{* 2055 * Determine the local host name for the current machine 2056 * @param p The pool to allocate from 2057 * @return A copy of the local host name 2058 } 2059//char *ap_get_local_host(apr_pool_t *p); 2060 2061{* 2062 * Log an assertion to the error log 2063 * @param szExp The assertion that failed 2064 * @param szFile The file the assertion is in 2065 * @param nLine The line the assertion is defined on 2066 } 2067procedure ap_log_assert(const szExp, szFile: PChar; nLine: Integer); 2068 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 2069 external LibHTTPD name LibNamePrefix + 'ap_log_assert' + LibSuff12; 2070 2071{* 2072 * @internal Internal Assert function 2073 } 2074{#define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__)) } 2075{* 2076 * Redefine assert() to something more useful for an Apache... 2077 * 2078 * Use ap_assert() if the condition should always be checked. 2079 * Use AP_DEBUG_ASSERT() if the condition should only be checked when AP_DEBUG 2080 * is defined. 2081 } 2082{#ifdef AP_DEBUG 2083#define AP_DEBUG_ASSERT(exp) ap_assert(exp) 2084#else 2085#define AP_DEBUG_ASSERT(exp) ((void)0) 2086#endif } 2087{* 2088 * @defgroup stopsignal Flags which indicate places where the server should stop for debugging. 2089 * @ 2090 * A set of flags which indicate places where the server should raise(SIGSTOP). 2091 * This is useful for debugging, because you can then attach to that process 2092 * with gdb and continue. This is important in cases where one_process 2093 * debugging isn't possible. 2094 } 2095{* stop on a Detach } 2096{#define SIGSTOP_DETACH 1 } 2097{* stop making a child process } 2098{#define SIGSTOP_MAKE_CHILD 2 } 2099{* stop spawning a child process } 2100{#define SIGSTOP_SPAWN_CHILD 4 } 2101{* stop spawning a child process with a piped log } 2102{#define SIGSTOP_PIPED_LOG_SPAWN 8 } 2103{* stop spawning a CGI child process } 2104{#define SIGSTOP_CGI_CHILD 16 } 2105{* Macro to get GDB started } 2106{#ifdef DEBUG_SIGSTOP 2107extern int raise_sigstop_flags; 2108#define RAISE_SIGSTOP(x) do if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP); while (0) 2109#else 2110#define RAISE_SIGSTOP(x) 2111#endif } 2112{* @ } 2113 2114{* 2115 * Get HTML describing the address and (optionally) admin of the server. 2116 * @param prefix Text which is prepended to the return value 2117 * @param r The request_rec 2118 * @return HTML describing the server, allocated in @a r's pool. 2119 } 2120function ap_psignature(const prefix: PChar; r: Prequest_rec): PChar; 2121 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 2122 external LibHTTPD name LibNamePrefix + 'ap_psignature' + LibSuff8; 2123 2124 2125{* strtoul does not exist on sunos4. } 2126{$ifdef strtoul} 2127{$undef strtoul} 2128{$endif} 2129 2130///** strtoul does not exist on sunos4. */ 2131//#ifdef strtoul 2132//#undef strtoul 2133//#endif 2134//#define strtoul strtoul_is_not_a_portable_function_use_strtol_instead 2135 2136{ The C library has functions that allow const to be silently dropped ... 2137 these macros detect the drop in maintainer mode, but use the native 2138 methods for normal builds 2139 2140 Note that on some platforms (e.g., AIX with gcc, Solaris with gcc), string.h needs 2141 to be included before the macros are defined or compilation will fail. 2142 } 2143{#include <string.h> 2144 2145AP_DECLARE(char *) ap_strchr(char *s, int c); 2146AP_DECLARE(const char *) ap_strchr_c(const char *s, int c); 2147AP_DECLARE(char *) ap_strrchr(char *s, int c); 2148AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c); 2149AP_DECLARE(char *) ap_strstr(char *s, const char *c); 2150AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c); 2151 2152#ifdef AP_DEBUG 2153 2154#undef strchr 2155# define strchr(s, c) ap_strchr(s,c) 2156#undef strrchr 2157# define strrchr(s, c) ap_strrchr(s,c) 2158#undef strstr 2159# define strstr(s, c) ap_strstr(s,c) 2160 2161#else 2162 } 2163{* use this instead of strchr } 2164{# define ap_strchr(s, c) strchr(s, c) } 2165{* use this instead of strchr } 2166{# define ap_strchr_c(s, c) strchr(s, c) } 2167{* use this instead of strrchr } 2168{# define ap_strrchr(s, c) strrchr(s, c) } 2169{* use this instead of strrchr } 2170{# define ap_strrchr_c(s, c) strrchr(s, c) } 2171{* use this instead of strrstr } 2172{# define ap_strstr(s, c) strstr(s, c) } 2173{* use this instead of strrstr } 2174{# define ap_strstr_c(s, c) strstr(s, c) } 2175{#endif } 2176 2177{* 2178 * Generate pseudo random bytes. 2179 * This is a convenience interface to apr_random. It is cheaper but less 2180 * secure than apr_generate_random_bytes(). 2181 * @param buf where to store the bytes 2182 * @param size number of bytes to generate 2183 * @note ap_random_insecure_bytes() is thread-safe, it uses a mutex on 2184 * threaded MPMs. 2185 } 2186procedure ap_random_insecure_bytes(buf: Pointer; size: apr_size_t); 2187 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 2188 external LibHTTPD name LibNamePrefix + 'ap_random_insecure_bytes' + LibSuff8; 2189 2190{* 2191 * Get a pseudo random number in a range. 2192 * @param min low end of range 2193 * @param max high end of range 2194 * @return a number in the range 2195 } 2196function ap_random_pick(min, max: apr_uint32_t): apr_uint32_t; 2197 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 2198 external LibHTTPD name LibNamePrefix + 'ap_random_pick' + LibSuff8; 2199 2200{* 2201 * Abort with a error message signifying out of memory 2202 } 2203//AP_DECLARE(void) ap_abort_on_oom(void) __attribute__((noreturn)); 2204procedure ap_abort_on_oom; 2205 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 2206 external LibHTTPD name LibNamePrefix + 'ap_abort_on_oom' + LibSuff0; 2207 2208{* 2209 * Wrapper for malloc() that calls ap_abort_on_oom() if out of memory 2210 * @param size size of the memory block 2211 * @return pointer to the allocated memory 2212 * @note ap_malloc may be implemented as a macro 2213 } 2214function ap_malloc(size: size_t): Pointer; 2215 {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 2216 external LibHTTPD name LibNamePrefix + 'ap_malloc' + LibSuff4; 2217 2218{* 2219 * Wrapper for calloc() that calls ap_abort_on_oom() if out of memory 2220 * @param nelem number of elements to allocate memory for 2221 * @param size size of a single element 2222 * @return pointer to the allocated memory 2223 * @note ap_calloc may be implemented as a macro 2224 } 2225//AP_DECLARE(void *) ap_calloc(size_t nelem, size_t size) 2226// __attribute__((malloc)) 2227// AP_FN_ATTR_ALLOC_SIZE2(1,2); 2228 2229{* 2230 * Wrapper for realloc() that calls ap_abort_on_oom() if out of memory 2231 * @param ptr pointer to the old memory block (or NULL) 2232 * @param size new size of the memory block 2233 * @return pointer to the reallocated memory 2234 * @note ap_realloc may be implemented as a macro 2235 } 2236//AP_DECLARE(void *) ap_realloc(void *ptr, size_t size) 2237 2238//#define AP_NORESTART APR_OS_START_USEERR + 1 2239 2240{ !APACHE_HTTPD_H } 2241{* @ //APACHE Daemon } 2242{* @ //APACHE Core } 2243{* @ //APACHE super group } 2244 2245