diff --git a/httpd/httpd_1_3/ap.inc b/httpd/httpd_1_3/ap.inc new file mode 100644 index 000000000..72e9568b1 --- /dev/null +++ b/httpd/httpd_1_3/ap.inc @@ -0,0 +1,149 @@ +{ Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + } + +{ + * The ap_vsnprintf/ap_snprintf functions are based on, and used with the + * permission of, the SIO stdio-replacement strx_* functions by Panos + * Tsirigotis for xinetd. + } + +{API_EXPORT(char *) ap_cpystrn(char *, const char *, size_t); +int ap_slack(int, int); +int ap_execle(const char *, const char *, ...); +int ap_execve(const char *, char * const argv[], char * const envp[]); +API_EXPORT(int) ap_getpass(const char *prompt, char *pwbuf, size_t bufsiz);} + +{$ifndef ap_strtol} +//API_EXPORT(long) ap_strtol(const char *nptr, char **endptr, int base); +{$endif} + +{ small utility macros to make things easier to read } + +{.$ifdef WIN32 +#define ap_killpg(x, y) +#else +#ifdef NO_KILLPG +#define ap_killpg(x, y) (kill (-(x), (y))) +#else +#define ap_killpg(x, y) (killpg ((x), (y))) +#endif +#endif} { WIN32 } + +{ ap_vformatter() is a generic printf-style formatting routine + * with some extensions. The extensions are: + * + * %pA takes a struct in_addr *, and prints it as a.b.c.d + * %pI takes a struct sockaddr_in * and prints it as a.b.c.d:port + * %pp takes a void * and outputs it in hex + * + * The %p hacks are to force gcc's printf warning code to skip + * over a pointer argument without complaining. This does + * mean that the ANSI-style %p (output a void * in hex format) won't + * work as expected at all, but that seems to be a fair trade-off + * for the increased robustness of having printf-warnings work. + * + * Additionally, ap_vformatter allows for arbitrary output methods + * using the ap_vformatter_buff and flush_func. + * + * The ap_vformatter_buff has two elements curpos and endpos. + * curpos is where ap_vformatter will write the next byte of output. + * It proceeds writing output to curpos, and updating curpos, until + * either the end of output is reached, or curpos == endpos (i.e. the + * buffer is full). + * + * If the end of output is reached, ap_vformatter returns the + * number of bytes written. + * + * When the buffer is full, the flush_func is called. The flush_func + * can return -1 to indicate that no further output should be attempted, + * and ap_vformatter will return immediately with -1. Otherwise + * the flush_func should flush the buffer in whatever manner is + * appropriate, re-initialize curpos and endpos, and return 0. + * + * Note that flush_func is only invoked as a result of attempting to + * write another byte at curpos when curpos >= endpos. So for + * example, it's possible when the output exactly matches the buffer + * space available that curpos == endpos will be true when + * ap_vformatter returns. + * + * ap_vformatter does not call out to any other code, it is entirely + * self-contained. This allows the callers to do things which are + * otherwise "unsafe". For example, ap_psprintf uses the "scratch" + * space at the unallocated end of a block, and doesn't actually + * complete the allocation until ap_vformatter returns. ap_psprintf + * would be completely broken if ap_vformatter were to call anything + * that used a pool. Similarly http_bprintf() uses the "scratch" + * space at the end of its output buffer, and doesn't actually note + * that the space is in use until it either has to flush the buffer + * or until ap_vformatter returns. + } + +type + ap_vformatter_buff = record + curpos: PChar; + endpos: PChar; + end; + +//API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *), +// ap_vformatter_buff *, const char *fmt, va_list ap); + +{ These are snprintf implementations based on ap_vformatter(). + * + * Note that various standards and implementations disagree on the return + * value of snprintf, and side-effects due to %n in the formatting string. + * ap_snprintf behaves as follows: + * + * Process the format string until the entire string is exhausted, or + * the buffer fills. If the buffer fills then stop processing immediately + * (so no further %n arguments are processed), and return the buffer + * length. In all cases the buffer is NUL terminated. The return value + * is the number of characters placed in the buffer, excluding the + * terminating NUL. All this implies that, at most, (len-1) characters + * will be copied over; if the return value is >= len, then truncation + * occured. + * + * In no event does ap_snprintf return a negative number. + } +//API_EXPORT_NONSTD(int) ap_snprintf(char *buf, size_t len, const char *format,...) +// __attribute__((format(printf,3,4))); +//API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format, +// va_list ap); +{ Simple BASE64 encode/decode functions. + * + * As we might encode binary strings, hence we require the length of + * the incoming plain source. And return the length of what we decoded. + * + * The decoding function takes any non valid char (i.e. whitespace, \0 + * or anything non A-Z,0-9 etc as terminal. + * + * plain strings/binary sequences are not assumed '\0' terminated. Encoded + * strings are neither. But propably should. + * + } +{API_EXPORT(int) ap_base64encode_len(int len); +API_EXPORT(int) ap_base64encode(char * coded_dst, const char *plain_src,int len_plain_src); +API_EXPORT(int) ap_base64encode_binary(char * coded_dst, const unsigned char *plain_src,int len_plain_src); + +API_EXPORT(int) ap_base64decode_len(const char * coded_src); +API_EXPORT(int) ap_base64decode(char * plain_dst, const char *coded_src); +API_EXPORT(int) ap_base64decode_binary(unsigned char * plain_dst, const char *coded_src);} + +{ Password validation, as used in AuthType Basic which is able to cope + * (based on the prefix) with the SHA1, Apache's internal MD5 and (depending + * on your platform either plain or crypt(3) passwords. + } +//API_EXPORT(char *) ap_validate_password(const char *passwd, const char *hash); + diff --git a/httpd/httpd_1_3/ap_alloc.inc b/httpd/httpd_1_3/ap_alloc.inc new file mode 100644 index 000000000..6221320af --- /dev/null +++ b/httpd/httpd_1_3/ap_alloc.inc @@ -0,0 +1,370 @@ +{ Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + } + +{ + * Resource allocation routines... + * + * designed so that we don't have to keep track of EVERYTHING so that + * it can be explicitly freed later (a fundamentally unsound strategy --- + * particularly in the presence of die()). + * + * Instead, we maintain pools, and allocate items (both memory and I/O + * handlers) from the pools --- currently there are two, one for per + * transaction info, and one for config info. When a transaction is over, + * we can delete everything in the per-transaction pool without fear, and + * without thinking too hard about it either. + * + * rst + } + +{ Arenas for configuration info and transaction info + * --- actual layout of the pool structure is private to + * alloc.c. + } + + { Need declaration of DIR on Win32 } +{$ifdef WIN32} +//#include "readdir.h" +{$endif} + +type + pool = record end; + Ppool = ^pool; + ap_pool = pool; + Pap_pool = ^ap_pool; + +//API_EXPORT(pool *) ap_init_alloc(void); { Set up everything } +//void ap_cleanup_alloc(void); +//API_EXPORT(pool *) ap_make_sub_pool(pool *); { All pools are subpools of permanent_pool } +//API_EXPORT(void) ap_destroy_pool(pool *); + +{ pools have nested lifetimes -- sub_pools are destroyed when the + * parent pool is cleared. We allow certain liberties with operations + * on things such as tables (and on other structures in a more general + * sense) where we allow the caller to insert values into a table which + * were not allocated from the table's pool. The table's data will + * remain valid as long as all the pools from which its values are + * allocated remain valid. + * + * For example, if B is a sub pool of A, and you build a table T in + * pool B, then it's safe to insert data allocated in A or B into T + * (because B lives at most as long as A does, and T is destroyed when + * B is cleared/destroyed). On the other hand, if S is a table in + * pool A, it is safe to insert data allocated in A into S, but it + * is *not safe* to insert data allocated from B into S... because + * B can be cleared/destroyed before A is (which would leave dangling + * pointers in T's data structures). + * + * In general we say that it is safe to insert data into a table T + * if the data is allocated in any ancestor of T's pool. This is the + * basis on which the POOL_DEBUG code works -- it tests these ancestor + * relationships for all data inserted into tables. POOL_DEBUG also + * provides tools (ap_find_pool, and ap_pool_is_ancestor) for other + * folks to implement similar restrictions for their own data + * structures. + * + * However, sometimes this ancestor requirement is inconvenient -- + * sometimes we're forced to create a sub pool (such as through + * ap_sub_req_lookup_uri), and the sub pool is guaranteed to have + * the same lifetime as the parent pool. This is a guarantee implemented + * by the *caller*, not by the pool code. That is, the caller guarantees + * they won't destroy the sub pool individually prior to destroying the + * parent pool. + * + * In this case the caller must call ap_pool_join() to indicate this + * guarantee to the POOL_DEBUG code. There are a few examples spread + * through the standard modules. + } +{$ifndef POOL_DEBUG} +//#define ap_pool_join(a,b) +{$else} +//API_EXPORT(void) ap_pool_join(pool *p, pool *sub); +//API_EXPORT(pool *) ap_find_pool(const void *ts); +//API_EXPORT(int) ap_pool_is_ancestor(pool *a, pool *b); +{$endif} + +{ Clearing out EVERYTHING in an pool... destroys any sub-pools } + +procedure ap_clear_pool(param1: Ppool); cdecl; external LibHTTPD; + +{ Preparing for exec() --- close files, etc., but *don't* flush I/O + * buffers, *don't* wait for subprocesses, and *don't* free any memory. + } + +//API_EXPORT(void) ap_cleanup_for_exec(void); + +{ routines to allocate memory from an pool... } + +//API_EXPORT(void *) ap_palloc(struct pool *, int nbytes); +//API_EXPORT(void *) ap_pcalloc(struct pool *, int nbytes); +//API_EXPORT(char *) ap_pstrdup(struct pool *, const char *s); +{ make a nul terminated copy of the n characters starting with s } +//API_EXPORT(char *) ap_pstrndup(struct pool *, const char *s, int n); +//API_EXPORT_NONSTD(char *) ap_pstrcat(struct pool *,...); { all '...' must be char* } +//API_EXPORT_NONSTD(char *) ap_psprintf(struct pool *, const char *fmt, ...) +// __attribute__((format(printf,2,3))); +//API_EXPORT(char *) ap_pvsprintf(struct pool *, const char *fmt, va_list); + +{ array and alist management... keeping lists of things. + * Common enough to want common support code ... + } + +type + Parray_header = ^array_header; + + array_header = record + pool: Pap_pool; + elt_size: cint; + nelts: cint; + nalloc: cint; + elts: PChar; + end; + +//API_EXPORT(array_header *) ap_make_array(pool *p, int nelts, int elt_size); +//API_EXPORT(void *) ap_push_array(array_header *); +//API_EXPORT(void) ap_array_cat(array_header *dst, const array_header *src); +//API_EXPORT(array_header *) ap_append_arrays(pool *, const array_header *, +// const array_header *); + +{ ap_array_pstrcat generates a new string from the pool containing + * the concatenated sequence of substrings referenced as elements within + * the array. The string will be empty if all substrings are empty or null, + * or if there are no elements in the array. + * If sep is non-NUL, it will be inserted between elements as a separator. + } +//API_EXPORT(char *) ap_array_pstrcat(pool *p, const array_header *arr, + // const char sep); + +{ copy_array copies the *entire* array. copy_array_hdr just copies + * the header, and arranges for the elements to be copied if (and only + * if) the code subsequently does a push or arraycat. + } + +//API_EXPORT(array_header *) ap_copy_array(pool *p, const array_header *src); +//API_EXPORT(array_header *) ap_copy_array_hdr(pool *p, const array_header *src); + + +{ Tables. Implemented alist style, for now, though we try to keep + * it so that imposing a hash table structure on top in the future + * wouldn't be *too* hard... + * + * Note that key comparisons for these are case-insensitive, largely + * because that's what's appropriate and convenient everywhere they're + * currently being used... + } + +type + table = record end; + + Ptable = ^table; + + table_entry = record + key: PChar; { maybe NULL in future; + * check when iterating thru table_elts + } + val: PChar; + end; + + table_entry_t = table_entry; + +{API_EXPORT(table *) ap_make_table(pool *p, int nelts); +API_EXPORT(table *) ap_copy_table(pool *p, const table *); +API_EXPORT(void) ap_clear_table(table *); +API_EXPORT(const char *) ap_table_get(const table *, const char *); +API_EXPORT(void) ap_table_set(table *, const char *name, const char *val); +API_EXPORT(void) ap_table_setn(table *, const char *name, const char *val); +API_EXPORT(void) ap_table_merge(table *, const char *name, const char *more_val); +API_EXPORT(void) ap_table_mergen(table *, const char *name, const char *more_val); +API_EXPORT(void) ap_table_unset(table *, const char *key); +API_EXPORT(void) ap_table_add(table *, const char *name, const char *val); +API_EXPORT(void) ap_table_addn(table *, const char *name, const char *val); +API_EXPORT_NONSTD(void) ap_table_do(int ( *comp) (void *, const char *, const char *), + void *rec, const table *t,...); + +API_EXPORT(table * ) ap_overlay_tables(pool *p, const table *overlay, const table *base); +} +{ Conceptually, ap_overlap_tables does this: + + array_header *barr = ap_table_elts(b); + table_entry *belt = (table_entry *)barr->elts; + int i; + + for (i = 0; i < barr->nelts; ++i) begin + if (flags & AP_OVERLAP_TABLES_MERGE) begin + ap_table_mergen(a, belt[i].key, belt[i].val); + end + else begin + ap_table_setn(a, belt[i].key, belt[i].val); + end; + end; + + Except that it is more efficient (less space and cpu-time) especially + when b has many elements. + + Notice the assumptions on the keys and values in b -- they must be + in an ancestor of a's pool. In practice b and a are usually from + the same pool. +} +const + AP_OVERLAP_TABLES_SET = (0); + AP_OVERLAP_TABLES_MERGE = (1); +//API_EXPORT(void) ap_overlap_tables(table *a, const table *b, unsigned flags); + +{ XXX: these know about the definition of struct table in alloc.c. That + * definition is not here because it is supposed to be private, and by not + * placing it here we are able to get compile-time diagnostics from modules + * written which assume that a table is the same as an array_header. -djg + } +//#define ap_table_elts(t) ((array_header *)(t)) +//#define ap_is_empty_table(t) (((t) == NULL)||(((array_header *)(t))->nelts == 0)) + +{ routines to remember allocation of other sorts of things... + * generic interface first. Note that we want to have two separate + * cleanup functions in the general case, one for exec() preparation, + * to keep CGI scripts and the like from inheriting access to things + * they shouldn't be able to touch, and one for actually cleaning up, + * when the actual server process wants to get rid of the thing, + * whatever it is. + * + * kill_cleanup disarms a cleanup, presumably because the resource in + * question has been closed, freed, or whatever, and it's scarce + * enough to want to reclaim (e.g., descriptors). It arranges for the + * resource not to be cleaned up a second time (it might have been + * reallocated). run_cleanup does the same, but runs it first. + * + * Cleanups are identified for purposes of finding & running them off by the + * plain_cleanup and data, which should presumably be unique. + * + * NB any code which invokes register_cleanup or kill_cleanup directly + * is a critical section which should be guarded by block_alarms() and + * unblock_alarms() below... + * + * ap_register_cleanup_ex provided to allow for an optional "cleanup" + * to be run at call-time for things like setting CLOSEXEC flags + * on fd's or whatever else may make sense. + } + +//API_EXPORT(void) ap_register_cleanup(pool *p, void *data, +// void (*plain_cleanup) (void *), +// void (*child_cleanup) (void *)); +//API_EXPORT(void) ap_register_cleanup_ex(pool *p, void *data, +// void (*plain_cleanup) (void *), +// void (*child_cleanup) (void *), +// int (*magic_cleanup) (void *)); + +//API_EXPORT(void) ap_kill_cleanup(pool *p, void *data, void (*plain_cleanup) (void *)); +//API_EXPORT(void) ap_run_cleanup(pool *p, void *data, void (*cleanup) (void *)); + +{ A "do-nothing" cleanup, for register_cleanup; it's faster to do + * things this way than to test for NULL. } +//API_EXPORT_NONSTD(void) ap_null_cleanup(void *data); + +{ The time between when a resource is actually allocated, and when it + * its cleanup is registered is a critical section, during which the + * resource could leak if we got interrupted or timed out. So, anything + * which registers cleanups should bracket resource allocation and the + * cleanup registry with these. (This is done internally by run_cleanup). + * + * NB they are actually implemented in http_main.c, since they are bound + * up with timeout handling in general... + } + +//API_EXPORT(void) ap_block_alarms(void); +//API_EXPORT(void) ap_unblock_alarms(void); + +{ Common cases which want utility support.. + * the note_cleanups_for_foo routines are for + } + +{API_EXPORT(FILE *) ap_pfopen(struct pool *, const char *name, const char *fmode); +API_EXPORT(FILE *) ap_pfdopen(struct pool *, int fd, const char *fmode); +API_EXPORT(int) ap_popenf(struct pool *, const char *name, int flg, int mode); +API_EXPORT(int) ap_popenf_ex(struct pool *, const char *name, int flg, + int mode, int domagic); + +API_EXPORT(void) ap_note_cleanups_for_file(pool *, FILE *); +API_EXPORT(void) ap_note_cleanups_for_file_ex(pool *, FILE *, int); +API_EXPORT(void) ap_note_cleanups_for_fd(pool *, int); +API_EXPORT(void) ap_note_cleanups_for_fd_ex(pool *, int, int);} +{$ifdef WIN32} +//API_EXPORT(void) ap_note_cleanups_for_h(pool *, HANDLE); +{$endif} +{API_EXPORT(void) ap_kill_cleanups_for_fd(pool *p, int fd); + +API_EXPORT(void) ap_note_cleanups_for_socket(pool *, int); +API_EXPORT(void) ap_note_cleanups_for_socket_ex(pool *, int, int); +API_EXPORT(void) ap_kill_cleanups_for_socket(pool *p, int sock); +API_EXPORT(int) ap_psocket(pool *p, int, int, int); +API_EXPORT(int) ap_psocket_ex(pool *p, int, int, int, int); +API_EXPORT(int) ap_pclosesocket(pool *a, int sock); + +API_EXPORT(regex_t *) ap_pregcomp(pool *p, const char *pattern, int cflags); +API_EXPORT(void) ap_pregfree(pool *p, regex_t * reg);} + +{ routines to note closes... file descriptors are constrained enough + * on some systems that we want to support this. + } + +{API_EXPORT(int) ap_pfclose(struct pool *, FILE *); +API_EXPORT(int) ap_pclosef(struct pool *, int fd); +#ifdef WIN32 +API_EXPORT(int) ap_pcloseh(struct pool *, HANDLE hDevice); +#endif} + +{ routines to deal with directories } +//API_EXPORT(DIR *) ap_popendir(pool *p, const char *name); +//API_EXPORT(void) ap_pclosedir(pool *p, DIR * d); + +{ ... even child processes (which we may want to wait for, + * or to kill outright, on unexpected termination). + * + * ap_spawn_child is a utility routine which handles an awful lot of + * the rigamarole associated with spawning a child --- it arranges + * for pipes to the child's stdin and stdout, if desired (if not, + * set the associated args to NULL). It takes as args a function + * to call in the child, and an argument to be passed to the function. + } + +type + kill_conditions = ( + kill_never, { process is never sent any signals } + kill_always, { process is sent SIGKILL on pool cleanup } + kill_after_timeout, { SIGTERM, wait 3 seconds, SIGKILL } + just_wait, { wait forever for the process to complete } + kill_only_once { send SIGTERM and then wait } + ); + +//typedef struct child_info child_info; +//API_EXPORT(void) ap_note_subprocess(pool *a, pid_t pid, +// enum kill_conditions how); +///API_EXPORT(int) ap_spawn_child(pool *, int (*)(void *, child_info *), +// void *, enum kill_conditions, +// FILE **pipe_in, FILE **pipe_out, +// FILE **pipe_err); +//int ap_close_fd_on_exec(int fd); + +{ magic numbers --- min free bytes to consider a free pool block useable, + * and the min amount to allocate if we have to go to malloc() } + +const + BLOCK_MINFREE = 4096; + BLOCK_MINALLOC = 8192; + +{ Finally, some accounting } + +//API_EXPORT(long) ap_bytes_in_pool(pool *p); +//API_EXPORT(long) ap_bytes_in_free_blocks(void); + diff --git a/httpd/httpd_1_3/ap_mmn.inc b/httpd/httpd_1_3/ap_mmn.inc new file mode 100644 index 000000000..528e58878 --- /dev/null +++ b/httpd/httpd_1_3/ap_mmn.inc @@ -0,0 +1,237 @@ +{ Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + } + +{ + * MODULE_MAGIC_NUMBER_MAJOR + * Major API changes that could cause compatibility problems for older modules + * such as structure size changes. No binary compatibility is possible across + * a change in the major version. + * + * MODULE_MAGIC_NUMBER_MINOR + * Minor API changes that do not cause binary compatibility problems. + * Should be reset to 0 when upgrading MODULE_MAGIC_NUMBER_MAJOR. + * + * See the MODULE_MAGIC_AT_LEAST macro below for an example. + } + +{ + * 19950525 - original value + * 19960512 (1.1b2) - updated, 1.1, version. + * 19960526 (1.1b3) - get_token(), table_unset(), pstrndup() + * functions added + * 19960725 (1.2-dev) - HTTP/1.1 compliance + * (new version of read_client_block) + * 19960806 (1.2-dev) - scan_script_header_err() added + * 19961007 (1.2-dev) - replace read_client_block() with get_client_block() + * 19961125 (1.2b1) - change setup_client_block() to Roy's version + * 19961211 (1.2b3) - rwrite() added + * 19970103 (1.2b5-dev) - header parse API + * 19970427 (1.2b9-dev) - port references made unsigned + * 19970526 (1.2) - correct vhost walk for multiple requests on a single + * connect + * 19970623 (1.3-dev) - NT changes + * 19970628 (1.3-dev) - ap_slack (fd fixes) added + * 19970717 (1.3-dev) - child_init API hook added + * 19970719 (1.3-dev) - discard_request_body() added (to clear the decks + * as needed) + * 19970728 (1.3a2-dev) - child_exit API hook added + * 19970818 (1.3a2-dev) - post read-request phase added + * 19970825 (1.3a2-dev) - r->mtime cell added + * 19970831 (1.3a2-dev) - error logging changed to use aplog_error() + * 19970902 (1.3a2-dev) - MD5 routines and structures renamed to ap_* + * 19970912 (1.3b1-dev) - set_last_modified split into set_last_modified, + * set_etag and meets_conditions + * register_other_child API + * piped_log API + * short_score split into parent and child pieces + * os_is_absolute_path + * 19971026 (1.3b3-dev) - custom config hooks in place + * 19980126 (1.3b4-dev) - ap_cpystrn(), table_addn(), table_setn(), + * table_mergen() + * 19980201 (1.3b4-dev) - construct_url() + * prototype server_rec * -> request_rec * + * add get_server_name() and get_server_port() + * 19980207 (1.3b4-dev) - add dynamic_load_handle to module structure as part + * of the STANDARD_MODULE_STUFF header + * 19980304 (1.3b6-dev) - abstraction of SERVER_BUILT and SERVER_VERSION + * 19980305 (1.3b6-dev) - ap_config.h added for use by external modules + * 19980312 (1.3b6-dev) - parse_uri_components() and its ilk + * remove r->hostlen, add r->unparsed_uri + * set_string_slot_lower() + * clarification: non-RAW_ARGS cmd handlers do not + * need to pstrdup() their arguments + * clarification: request_rec members content_type, + * handler, content_encoding, content_language, + * content_languages MUST all be lowercase strings, + * and MAY NOT be modified in place -- modifications + * require pstrdup(). + * 19980317 (1.3b6-dev) - CORE_EXPORTs for win32 and + * API export basic_http_header, send_header_field, + * set_keepalive, srm_command_loop, check_cmd_context, + * tm2sec + * spacetoplus(), plustospace(), client_to_stdout() + * removed + * 19980324 (1.3b6-dev) - API_EXPORT(index_of_response) + * 19980413 (1.3b6-dev) - The BIG SYMBOL RENAMING: general ap_ prefix + * (see src/include/compat.h for more details) + * ap_vformatter() API, see src/include/ap.h + * 19980507 (1.3b7-dev) - addition of ap_add_version_component() and + * discontinuation of -DSERVER_SUBVERSION support + * 19980519 (1.3b7-dev) - add child_info * to spawn function (as passed to + * ap_spawn_child_err_buff) and to ap_call_exec to make + * children work correctly on Win32. + * 19980527 (1.3b8-dev) - renamed some more functions to ap_ prefix which were + * missed at the big renaming (they are defines): + * is_default_port, default_port and http_method. + * A new communication method for modules was added: + * they can create customized error messages under the + * "error-notes" key in the request_rec->notes table. + * This string will be printed in place of the canned + * error responses, and will be propagated to + * ErrorDocuments or cgi scripts in the + * (REDIRECT_)ERROR_NOTES variable. + * 19980627 (1.3.1-dev) - More renaming that we forgot/bypassed. In particular: + * table_elts --> ap_table_elts + * is_table_empty --> ap_is_table_empty + * 19980708 (1.3.1-dev) - ap_isalnum(), ap_isalpha(), ... "8-bit safe" ctype + * macros and apctype.h added + * 19980713 (1.3.1-dev) - renaming of C header files: + * 1. conf.h -> ap_config.h + * 2. conf_auto.h -> ap_config_auto.h - now merged + * 3. ap_config.h -> ap_config_auto.h - now merged + * 4. compat.h -> ap_compat.h + * 5. apctype.h -> ap_ctype.h + * 19980806 (1.3.2-dev) - add ap_log_rerror() + * - add ap_scan_script_header_err_core() + * - add ap_uuencode() + * - add ap_custom_response() + * 19980811 (1.3.2-dev) - added limit_req_line, limit_req_fieldsize, and + * limit_req_fields to server_rec. + * added limit_req_body to core_dir_config and + * ap_get_limit_req_body() to get its value. + * 19980812 (1.3.2-dev) - split off MODULE_MAGIC_NUMBER + * 19980812.2 - add ap_overlap_tables() + * 19980816 (1.3.2-dev) - change proxy to use tables for headers, change + * struct cache_req to typedef cache_req. + * Delete ap_proxy_get_header(), ap_proxy_add_header(), + * ap_proxy_del_header(). Change interface of + * ap_proxy_send_fb() and ap_proxy_cache_error(). + * Add ap_proxy_send_hdr_line() and ap_proxy_bputs2(). + * 19980825 (1.3.2-dev) - renamed is_HTTP_xxx() macros to ap_is_HTTP_xxx() + * 19980825.1 - mod_proxy only (minor change): modified interface of + * ap_proxy_read_headers() and rdcache() to use a + * request_rec* instead of pool* + * (for implementing better error reporting). + * 19980906 (1.3.2-dev) - added ap_md5_binary() + * 19980917 (1.3.2-dev) - bs2000: changed os_set_authfile() to os_set_account() + * 19981108 (1.3.4-dev) - added ap_method_number_of() + * - changed value of M_INVALID and added WebDAV methods + * 19981108.1 - ap_exists_config_define() is now public (minor bump) + * 19981204 - scoreboard changes -- added generation, changed + * exit_generation to running_generation. Somewhere + * earlier vhostrec was added, but it's only safe to use + * as of this rev. See scoreboard.h for documentation. + * 19981211 - DSO changes -- added ap_single_module_configure() + * -- added ap_single_module_init() + * 19981229 - mod_negotiation overhaul -- added ap_make_etag() + * and added vlist_validator to request_rec. + * 19990101 - renamed macro escape_uri() to ap_escape_uri() + * - added MODULE_MAGIC_COOKIE to identify module structs + * 19990103 (1.3.4-dev) - added ap_array_pstrcat() + * 19990105 (1.3.4-dev) - added ap_os_is_filename_valid() + * 19990106 (1.3.4-dev) - Move MODULE_MAGIC_COOKIE to the end of the + * STANDARD_MODULE_STUFF macro so the version + * numbers and file name remain at invariant offsets + * 19990108 (1.3.4-dev) - status_drops_connection -> ap_status_drops_connection + * scan_script_header -> ap_scan_script_header_err + * - reordered entries in request_rec that were waiting + * for a non-binary-compatible release. + * (1.3.5-dev) + * 19990108.1 - add ap_MD5Encode() for MD5 password handling. + * 19990108.2 - add ap_validate_password() and change ap_MD5Encode() + * to use a stronger algorithm. + * 19990108.4 - add ap_size_list_item(), ap_get_list_item(), and + * ap_find_list_item() + * 19990108.5 - added ap_sub_req_method_uri() and added const to the + * definition of method in request_rec. + * 19990108.6 - SIGPIPE is now ignored by the core server. + * 19990108.7 - ap_isxdigit added + * 19990320 - METHODS and M_INVALID symbol values modified + * 19990320.1 - add ap_vrprintf() + * 19990320.2 - add cmd_parms.context, ap_set_config_vectors, + * export ap_add_file_conf + * 19990320.3 - add ap_regexec() and ap_regerror() + * 19990320.4 - add ap_field_noparam() + * 19990320.5 - add local_ip/host to conn_rec for mass-vhost + * 19990320.6 - add ap_SHA1Final(), ap_SHA1Init(), + * ap_SHA1Update_binary(), ap_SHA1Update(), + * ap_base64encode(), ap_base64encode_binary(), + * ap_base64encode_len(), ap_base64decode(), + * ap_base64decode_binary(), ap_base64decode_len(), + * ap_pbase64decode(), ap_pbase64encode() + * 19990320.7 - add ap_strcasestr() + * 19990320.8 - add request_rec.case_preserved_filename + * 19990320.9 - renamed alloc.h to ap_alloc.h + * 19990320.10 - add ap_is_rdirectory() and ap_stripprefix() + * 19990320.11 - Add a couple of fields, callback_data and + * filter_callback to the end of buff.h + * 19990320.11 - Add some fields to the end of the core_dir_config + * structure + * 19990320.12 - add ap_getline(), ap_get_chunk_size() + * 19990320.13 - add ap_strtol() + * 19990320.14 - add ap_register_cleanup_ex(), + * ap_note_cleanups_for_fd_ex(), + * ap_note_cleanups_for_socket_ex(), + * ap_note_cleanups_for_file_ex(), + * ap_popenf_ex() and ap_psocket_ex(). + * 19990320.15 - ap_is_recursion_limit_exceeded() + * 19990320.16 - ap_escape_errorlog_item() + * 19990320.17 - ap_auth_nonce() and ap_auth_nonce added + * in core_dir_config. + * 19990320.18 - trace_enable member added to core server_config + } + +const + MODULE_MAGIC_COOKIE = $41503133; { "AP13" } + + MODULE_MAGIC_NUMBER_MAJOR = 19990320; + MODULE_MAGIC_NUMBER_MINOR = 18; { 0...n } + +{ Useful for testing for features. } + +{#define AP_MODULE_MAGIC_AT_LEAST(major,minor) \ + ((major) < MODULE_MAGIC_NUMBER_MAJOR \ + || ((major) == MODULE_MAGIC_NUMBER_MAJOR \ + && (minor) <= MODULE_MAGIC_NUMBER_MINOR))} + +{ + * For example, suppose you wish to use the ap_overlap_tables + * function. You can do this: + * + * #if AP_MODULE_MAGIC_AT_LEAST(19980812,2) + * ... use ap_overlap_tables() + * #else + * ... alternative code which doesn't use ap_overlap_tables() + * #endif + * + } + +{ deprecated. present for backwards compatibility } + + MODULE_MAGIC_NUMBER = MODULE_MAGIC_NUMBER_MAJOR; + +//#define MODULE_MAGIC_AT_LEAST old_broken_macro_we_hope_you_are_not_using + diff --git a/httpd/httpd_1_3/buff.inc b/httpd/httpd_1_3/buff.inc new file mode 100644 index 000000000..d4e4f9eab --- /dev/null +++ b/httpd/httpd_1_3/buff.inc @@ -0,0 +1,205 @@ +{ Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + } + +{$ifdef B_SFIO} +#include "sfio.h" +{$endif} + +//#include + +{ Reading is buffered } + B_RD = (1); +{ Writing is buffered } + B_WR = (2); + B_RDWR = (3); +{ At end of file, or closed stream; no further input allowed } + B_EOF = (4); +{ No further output possible } + B_EOUT = (8); +{ A read error has occurred } + B_RDERR =(16); +{ A write error has occurred } + B_WRERR =(32); +//#ifdef B_ERROR { in SVR4: sometimes defined in /usr/include/sys/buf.h } +//#undef B_ERROR +//#endif + B_ERROR =(48); +{ Use chunked writing } + B_CHUNK =(64); +{ bflush() if a read would block } + B_SAFEREAD =(128); +{ buffer is a socket } + B_SOCKET =(256); +{$ifdef CHARSET_EBCDIC} + B_ASCII2EBCDIC = $40000000; { Enable conversion for this buffer } + B_EBCDIC2ASCII = $80000000; { Enable conversion for this buffer } +{$endif} {CHARSET_EBCDIC} + +type + Pbuff_struct = ^buff_struct; + + PBUFF = Pbuff_struct; + + error_t = procedure (fb: PBUFF; op: cint; data: Pointer); + + filter_callback_t = procedure (param1: PBUFF; const param2: Pointer; param3: cint); + + buff_struct = record + flags: cint; { flags } + inptr: PChar; { pointer to next location to read } + incnt: cint; { number of bytes left to read from input buffer; + * always 0 if had a read error } + outchunk: cint; { location of chunk header when chunking } + outcnt: cint; { number of byte put in output buffer } + inbase: PChar; + outbase: PChar; + bufsiz: cint; + error: error_t; + error_data: PChar; + bytes_sent: clong; { number of bytes actually written } + + pool: Pap_pool; + +{ could also put pointers to the basic I/O routines here } + fd: cint; { the file descriptor } + fd_in: cint; { input file descriptor, if different } +{$ifdef WIN32} + hFH: HANDLE; { Windows filehandle } +{$endif} + + { transport handle, for RPC binding handle or some such } + t_handle: PChar; + +{$ifdef B_SFIO} + sf_in: PSfio_t; + sf_out: PSfio_t; +{$endif} + + callback_data: Pointer; + filter_callback: filter_callback_t; + + end; + +{$ifdef B_SFIO} + apache_sfio = record + disc: Sfdisc_t; + buff: PBUFF; + end; + +extern Sfdisc_t *bsfio_new(pool *p, BUFF *b); +{$endif} + +{ Options to bset/getopt } +const + BO_BYTECT = (1); + +{ Stream creation and modification } +{API_EXPORT(BUFF *) ap_bcreate(pool *p, int flags); +API_EXPORT(void) ap_bpushfd(BUFF *fb, int fd_in, int fd_out); +#ifdef WIN32 +API_EXPORT(void) ap_bpushh(BUFF *fb, HANDLE hFH); +#endif +API_EXPORT(int) ap_bsetopt(BUFF *fb, int optname, const void *optval); +API_EXPORT(int) ap_bgetopt(BUFF *fb, int optname, void *optval); +API_EXPORT(int) ap_bsetflag(BUFF *fb, int flag, int value); +API_EXPORT(int) ap_bclose(BUFF *fb);} + +//#define ap_bgetflag(fb, flag) ((fb)->flags & (flag)) + +{ Error handling } +//API_EXPORT(void) ap_bonerror(BUFF *fb, void (*error) (BUFF *, int, void *), +// void *data); + +{ I/O } +{API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte); +API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb); +API_EXPORT(int) ap_blookc(char *buff, BUFF *fb); +API_EXPORT(int) ap_bskiplf(BUFF *fb); +API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte); +API_EXPORT(int) ap_bflush(BUFF *fb); +API_EXPORT(int) ap_bputs(const char *x, BUFF *fb); +API_EXPORT_NONSTD(int) ap_bvputs(BUFF *fb,...); +API_EXPORT_NONSTD(int) ap_bprintf(BUFF *fb, const char *fmt,...) + __attribute__((format(printf,2,3))); +API_EXPORT(int) ap_vbprintf(BUFF *fb, const char *fmt, va_list vlist); +} +{ Internal routines } +{API_EXPORT(int) ap_bflsbuf(int c, BUFF *fb); +API_EXPORT(int) ap_bfilbuf(BUFF *fb); + +#ifndef CHARSET_EBCDIC + +#define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \ + ((fb)->incnt--, *((fb)->inptr++)) ) + +#define ap_bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \ + (fb)->outcnt == (fb)->bufsiz) ? ap_bflsbuf(c, (fb)) : \ + ((fb)->outbase[(fb)->outcnt++] = (c), 0)) + +#else} {CHARSET_EBCDIC} +{ +#define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \ + ((fb)->incnt--, (fb->flags & B_ASCII2EBCDIC)\ + ?os_toebcdic[(unsigned char)*((fb)->inptr++)]:*((fb)->inptr++)) ) + +#define ap_bputc(c, fb) ((((fb)->flags & (B_EOUT|B_WRERR|B_WR)) != B_WR || \ + (fb)->outcnt == (fb)->bufsiz) ? ap_bflsbuf(c, (fb)) : \ + ((fb)->outbase[(fb)->outcnt++] = (fb->flags & B_EBCDIC2ASCII)\ + ?os_toascii[(unsigned char)c]:(c), 0)) + +#endif} {CHARSET_EBCDIC} + +type + child_info = record +{$ifdef WIN32} + { + * These handles are used by ap_call_exec to call + * create process with pipe handles. + } + hPipeInputRead: HANDLE; + hPipeOutputWrite: HANDLE; + hPipeErrorWrite: HANDLE; +{$else} + { + * We need to put a dummy member in here to avoid compilation + * errors under certain Unix compilers, like SGI's and HPUX's, + * which fail to compile a zero-sized struct. Of course + * it would be much nicer if there was actually a use for this + * structure under Unix. Aah the joys of x-platform code. + } + dummy: cint; +{$endif} + end; +//API_EXPORT(int) ap_bspawn_child(pool *, int (*)(void *, child_info *), void *, +// enum kill_conditions, BUFF **pipe_in, BUFF **pipe_out, +// BUFF **pipe_err); + +{ enable non-blocking operations } +//API_EXPORT(int) ap_bnonblock(BUFF *fb, int direction); +{ and get an fd to select() on } +//API_EXPORT(int) ap_bfileno(BUFF *fb, int direction); + +{ bflush() if a read now would block, but don't actually read anything } +//API_EXPORT(void) ap_bhalfduplex(BUFF *fb); + +{$if defined(WIN32) or defined(NETWARE) or defined(CYGWIN_WINSOCK)} + +{ ap_recvwithtimeout/ap_sendwithtimeout socket primitives for WinSock } +//API_EXPORT(int) ap_sendwithtimeout(int sock, const char *buf, int len, int flags); +//API_EXPORT(int) ap_recvwithtimeout(int sock, char *buf, int len, int flags); + +{$endif} + diff --git a/httpd/httpd_1_3/hsregex.inc b/httpd/httpd_1_3/hsregex.inc new file mode 100644 index 000000000..4c0d742da --- /dev/null +++ b/httpd/httpd_1_3/hsregex.inc @@ -0,0 +1,97 @@ +{ DON'T EVEN THINK ABOUT EDITING THIS, go see regex/Makefile, + * search for mkh } + +{ ========= begin header generated by ./mkh ========= } + +{ === regex2.h === } +{#ifndef API_EXPORT +#ifdef WIN32 +#define API_EXPORT(type) __declspec(dllexport) type __stdcall +#else +#define API_EXPORT(type) type +#endif +#endif} + +{#if defined(MAC_OS) || defined(MAC_OS_X_SERVER) || (defined(DARWIN) && defined(__DYNAMIC__)) +#define ap_private_extern __private_extern__ +#else +#define ap_private_extern +#endif} + +type + regoff_t = Integer; + +// off_t = regoff_t; + + Pregex_t = ^regex_t; + + Pre_guts = Pointer; + + regex_t = record + re_magic: cint; + re_nsub: size_t; { number of parenthesized subexpressions } + re_endp: PChar; { end pointer for REG_PEND } + re_g: Pre_guts; { none of your business :-) } + end; + + regmatch_t = record + rm_so: regoff_t; { start of match } + rm_eo: regoff_t; { end of match } + end; + + +{ === regcomp.c === } +//API_EXPORT(int) regcomp(regex_t *, const char *, int); + +const + REG_BASIC = 0000; + REG_EXTENDED = 0001; + REG_ICASE = 0002; + REG_NOSUB = 0004; + REG_NEWLINE = 0010; + REG_NOSPEC = 0020; + REG_PEND = 0040; + REG_DUMP = 0200; + + +{ === regerror.c === } + REG_NOMATCH = 1; + REG_BADPAT = 2; + REG_ECOLLATE = 3; + REG_ECTYPE = 4; + REG_EESCAPE = 5; + REG_ESUBREG = 6; + REG_EBRACK = 7; + REG_EPAREN = 8; + REG_EBRACE = 9; + REG_BADBR =10; + REG_ERANGE =11; + REG_ESPACE =12; + REG_BADRPT =13; + REG_EMPTY =14; + REG_ASSERT =15; + REG_INVARG =16; + REG_ATOI =255; { convert name to number (!) } + REG_ITOA =0400; { convert number to name (!) } + +//API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t); + + +{ === regexec.c === } +//API_EXPORT(int) regexec(const regex_t *, const char *, size_t, regmatch_t [], int); + +const + REG_NOTBOL = 00001; + REG_NOTEOL = 00002; + REG_STARTEND = 00004; + REG_TRACE = 00400; { tracing of execution } + REG_LARGE = 01000; { force large representation } + REG_BACKR = 02000; { force use of backref code } + + +{ === regfree.c === } +//API_EXPORT(void) regfree(regex_t *); + + +{ ========= end header generated by ./mkh ========= } + diff --git a/httpd/httpd_1_3/http_config.inc b/httpd/httpd_1_3/http_config.inc new file mode 100644 index 000000000..9a191b7f8 --- /dev/null +++ b/httpd/httpd_1_3/http_config.inc @@ -0,0 +1,388 @@ +{ Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + } + +{ + * The central data structures around here... + } + +{ Command dispatch structures... } + +{ Note that for all of these except RAW_ARGS, the config routine is + * passed a freshly allocated string which can be modified or stored + * or whatever... it's only necessary to do pstrdup() stuff with + * RAW_ARGS. + } +type + cmd_how = ( + RAW_ARGS, { cmd_func parses command line itself } + TAKE1, { one argument only } + TAKE2, { two arguments only } + ITERATE, { one argument, occuring multiple times + * (e.g., IndexIgnore) + } + ITERATE2, { two arguments, 2nd occurs multiple times + * (e.g., AddIcon) + } + FLAG, { One of 'On' or 'Off' } + NO_ARGS, { No args at all, e.g. } + TAKE12, { one or two arguments } + TAKE3, { three arguments only } + TAKE23, { two or three arguments } + TAKE123, { one, two or three arguments } + TAKE13 { one or three arguments } + ); + + func_t = function (): PChar; + + command_struct = record + name: PChar; { Name of this command } + func: func_t; { Function invoked } + cmd_data: Pointer; { Extra data, for functions which + * implement multiple commands... + } + req_override: cint; { What overrides need to be allowed to + * enable this command. + } + args_how: cmd_how; { What the command expects as arguments } + + errmsg: PChar; { 'usage' message, in case of syntax errors } + end; + + command_rec = command_struct; + + Pcommand_rec = ^command_rec; + +{ The allowed locations for a configuration directive are the union of + * those indicated by each set bit in the req_override mask. + * + * (req_override & RSRC_CONF) => *.conf outside or + * (req_override & ACCESS_CONF) => *.conf inside or + * (req_override & OR_AUTHCFG) => *.conf inside or + * and .htaccess when AllowOverride AuthConfig + * (req_override & OR_LIMIT) => *.conf inside or + * and .htaccess when AllowOverride Limit + * (req_override & OR_OPTIONS) => *.conf anywhere + * and .htaccess when AllowOverride Options + * (req_override & OR_FILEINFO) => *.conf anywhere + * and .htaccess when AllowOverride FileInfo + * (req_override & OR_INDEXES) => *.conf anywhere + * and .htaccess when AllowOverride Indexes + } +const + OR_NONE = 0; + OR_LIMIT = 1; + OR_OPTIONS = 2; + OR_FILEINFO = 4; + OR_AUTHCFG = 8; + OR_INDEXES = 16; + OR_UNSET = 32; + ACCESS_CONF = 64; + RSRC_CONF = 128; + OR_ALL = (OR_LIMIT or OR_OPTIONS or OR_FILEINFO or OR_AUTHCFG or OR_INDEXES); + +{ This can be returned by a function if they don't wish to handle + * a command. Make it something not likely someone will actually use + * as an error code. + } + + DECLINE_CMD = '\a\b'; + +{ + * This structure is passed to a command which is being invoked, + * to carry a large variety of miscellaneous data which is all of + * use to *somebody*... + } + +type + cmd_parms = record + info: Pointer; { Argument to command from cmd_table } + override: cint; { Which allow-override bits are set } + limited: cint; { Which methods are ed } + + config_file: Pconfigfile_t; { Config file structure from pcfg_openfile() } + + pool: Pap_pool; { Pool to allocate new storage in } + temp_pool: Ppool; { Pool for scratch memory; persists during + * configuration, but wiped before the first + * request is served... + } + server: Pserver_rec; { Server_rec being configured for } + path: PChar; { If configuring for a directory, + * pathname of that directory. + * NOPE! That's what it meant previous to the + * existance of , and regex + * matching. Now the only usefulness that can + * be derived from this field is whether a command + * is being called in a server context (path == NULL) + * or being called in a dir context (path != NULL). + } + cmd: Pcommand_rec; { configuration command } + end_token: PChar; { end token required to end a nested section } + context: Pointer; { per_dir_config vector passed + * to handle_command } + end; + +{ This structure records the existence of handlers in a module... } + + handler_t = function (param1: Prequest_rec): Integer; cdecl; + + Phandler_rec = ^handler_rec; + + handler_rec = record + content_type: PChar; { MUST be all lower case } + handler: handler_t; + end; + +{ + * Module structures. Just about everything is dispatched through + * these, directly or indirectly (through the command and handler + * tables). + } + + Pmodule_struct = ^module_struct; + +{$ifdef ULTRIX_BRAIN_DEATH} + init_t = procedure (); cdecl; + create_dir_config_t = function (): Pointer; cdecl; + merge_dir_config_t = function (): Pointer; cdecl; + create_server_config_t = function (): Pointer; cdecl; + merge_server_config_t = function (): Pointer; cdecl; +{$else} + init_t = procedure (param1: Pserver_rec; param2: Ppool); cdecl; + create_dir_config_t = function (p: Ppool; dir: PChar): Pointer; cdecl; + merge_dir_config_t = function (p: PPool; base_conf, new_conf: Pointer): Pointer; cdecl; + create_server_config_t = function (p: Ppool; s: Pserver_rec): Pointer; cdecl; + merge_server_config_t = function (p: Ppool; base_conf, new_conf: Pointer): Pointer; cdecl; +{$endif} + + hook_t = function (param1: Prequest_rec): cint; cdecl; + + child_init_t = procedure (param1: Pserver_rec; param2: Ppool); cdecl; + child_exit_t = procedure (param1: Pserver_rec; param2: Ppool); cdecl; + + module_struct = record + version: cint; { API version, *not* module version; + * check that module is compatible with this + * version of the server. + } + minor_version: cint; { API minor version. Provides API feature + * milestones. Not checked during module init + } + module_index: cint; { Index to this modules structures in + * config vectors. + } + + name: PChar; + dynamic_load_handle: Pointer; + + next: Pmodule_struct; + + magic: culong; { Magic Cookie to identify a module structure; + * It's mainly important for the DSO facility + * (see also mod_so). + } + + { init() occurs after config parsing, but before any children are + * forked. + * Modules should not rely on the order in which create_server_config + * and create_dir_config are called. + } + + init: init_t; + create_dir_config: create_dir_config_t; + merge_dir_config: merge_dir_config_t; + create_server_config: create_server_config_t; + merge_server_config: merge_server_config_t; + + cmds: Pcommand_rec; + handlers: Phandler_rec; + + { Hooks for getting into the middle of server ops... + + * translate_handler --- translate URI to filename + * access_checker --- check access by host address, etc. All of these + * run; if all decline, that's still OK. + * check_user_id --- get and validate user id from the HTTP request + * auth_checker --- see if the user (from check_user_id) is OK *here*. + * If all of *these* decline, the request is rejected + * (as a SERVER_ERROR, since the module which was + * supposed to handle this was configured wrong). + * type_checker --- Determine MIME type of the requested entity; + * sets content_type, _encoding and _language fields. + * logger --- log a transaction. + * post_read_request --- run right after read_request or internal_redirect, + * and not run during any subrequests. + } + + translate_handler: hook_t; + ap_check_user_id: hook_t; + auth_checker: hook_t; + access_checker: hook_t; + type_checker: hook_t; + fixer_upper: hook_t; + logger: hook_t; + header_parser: hook_t; + + { Regardless of the model the server uses for managing "units of + * execution", i.e. multi-process, multi-threaded, hybrids of those, + * there is the concept of a "heavy weight process". That is, a + * process with its own memory space, file spaces, etc. This method, + * child_init, is called once for each heavy-weight process before + * any requests are served. Note that no provision is made yet for + * initialization per light-weight process (i.e. thread). The + * parameters passed here are the same as those passed to the global + * init method above. + } +{$ifdef ULTRIX_BRAIN_DEATH} + void ( *child_init) (); + void ( *child_exit) (); +{$else} + child_init: child_init_t; + child_exit: child_exit_t; +{$endif} + post_read_request: hook_t; + end; + + module = module_struct; + + Pmodule = ^module; + +{ Initializer for the first few module slots, which are only + * really set up once we start running. Note that the first two slots + * provide a version check; this should allow us to deal with changes to + * the API. The major number should reflect changes to the API handler table + * itself or removal of functionality. The minor number should reflect + * additions of functionality to the existing API. (the server can detect + * an old-format module, and either handle it back-compatibly, or at least + * signal an error). See src/include/ap_mmn.h for MMN version history. + } + +procedure STANDARD_MODULE_STUFF(var mod_: module); + +{ Generic accessors for other modules to get at their own module-specific + * data + } + +{API_EXPORT(void *) ap_get_module_config(void *conf_vector, module *m); +API_EXPORT(void) ap_set_module_config(void *conf_vector, module *m, void *val); + +#define ap_get_module_config(v,m) \ + (((void **)(v))[(m)->module_index]) +#define ap_set_module_config(v,m,val) \ + ((((void **)(v))[(m)->module_index]) = (val))} + +{ Generic command handling function... } + +{API_EXPORT_NONSTD(const char *) ap_set_string_slot(cmd_parms *, char *, char *); +API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *, char *, char *); +API_EXPORT_NONSTD(const char *) ap_set_flag_slot(cmd_parms *, char *, int); +API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *, char *, char *);} + +{ For modules which need to read config files, open logs, etc. ... + * this returns the fname argument if it begins with '/'; otherwise + * it relativizes it wrt server_root. + } + +//API_EXPORT(char *) ap_server_root_relative(pool *p, char *fname); + +{ Finally, the hook for dynamically loading modules in... } + +{API_EXPORT(void) ap_add_module(module *m); +API_EXPORT(void) ap_remove_module(module *m); +API_EXPORT(void) ap_add_loaded_module(module *mod); +API_EXPORT(void) ap_remove_loaded_module(module *mod); +API_EXPORT(int) ap_add_named_module(const char *name); +API_EXPORT(void) ap_clear_module_list(void); +API_EXPORT(const char *) ap_find_module_name(module *m); +API_EXPORT(module *) ap_find_linked_module(const char *name);} + +{ for implementing subconfigs and customized config files } +{API_EXPORT(const char *) ap_srm_command_loop(cmd_parms *parms, void *config); + +#ifdef CORE_PRIVATE + +extern API_VAR_EXPORT module *top_module; + +extern module *ap_prelinked_modules[]; +extern module *ap_preloaded_modules[]; +extern API_VAR_EXPORT module **ap_loaded_modules;} + +{ For mod_so.c... } + +//API_EXPORT(void) ap_single_module_configure(pool *p, server_rec *s, module *m); + +{ For http_main.c... } + +{API_EXPORT(server_rec *) ap_read_config(pool *conf_pool, pool *temp_pool, char *config_name); +API_EXPORT(void) ap_init_modules(pool *p, server_rec *s); +API_EXPORT(void) ap_child_init_modules(pool *p, server_rec *s); +API_EXPORT(void) ap_child_exit_modules(pool *p, server_rec *s); +API_EXPORT(void) ap_setup_prelinked_modules(void); +API_EXPORT(void) ap_show_directives(void); +API_EXPORT(void) ap_show_modules(void); +void ap_cleanup_method_ptrs(void);} + +{ For http_request.c... } + +{CORE_EXPORT(void *) ap_create_request_config(pool *p); +CORE_EXPORT(void *) ap_create_per_dir_config(pool *p); +CORE_EXPORT(void *) ap_merge_per_dir_configs(pool *p, void *base, void *new);} + +{ For http_core.c... ( command and virtual hosts) } + +{CORE_EXPORT(int) ap_parse_htaccess(void **result, request_rec *r, int override, + const char *path, const char *access_name); + +CORE_EXPORT(const char *) ap_init_virtual_host(pool *p, const char *hostname, + server_rec *main_server, server_rec **); +CORE_EXPORT(void) ap_process_resource_config(server_rec *s, char *fname, pool *p, pool *ptemp); +} +{ ap_check_cmd_context() definitions: } +//API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden); + +{ ap_check_cmd_context(): Forbidden in: } +const + NOT_IN_VIRTUALHOST = $01; { } + NOT_IN_LIMIT = $02; { } + NOT_IN_DIRECTORY = $04; { } + NOT_IN_LOCATION = $08; { } + NOT_IN_FILES = $10; { } + NOT_IN_DIR_LOC_FILE = (NOT_IN_DIRECTORY or NOT_IN_LOCATION or NOT_IN_FILES); { //} + GLOBAL_ONLY = (NOT_IN_VIRTUALHOST or NOT_IN_LIMIT or NOT_IN_DIR_LOC_FILE); + + +{ Module-method dispatchers, also for http_request.c } + +//API_EXPORT(int) ap_translate_name(request_rec *); +//API_EXPORT(int) ap_check_access(request_rec *); { check access on non-auth basis } +//API_EXPORT(int) ap_check_user_id(request_rec *); { obtain valid username from client auth } +//API_EXPORT(int) ap_check_auth(request_rec *); { check (validated) user is authorized here } +//API_EXPORT(int) ap_find_types(request_rec *); { identify MIME type } +//API_EXPORT(int) ap_run_fixups(request_rec *); { poke around for other metainfo, etc.... } +//API_EXPORT(int) ap_invoke_handler(request_rec *); +//API_EXPORT(int) ap_log_transaction(request_rec *r); +//API_EXPORT(int) ap_header_parse(request_rec *); +//API_EXPORT(int) ap_run_post_read_request(request_rec *); + +{ for mod_perl } + +//CORE_EXPORT(const command_rec *) ap_find_command(const char *name, const command_rec *cmds); +//CORE_EXPORT(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod); +//CORE_EXPORT(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod); +//CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, const char *l); + +//#endif + diff --git a/httpd/httpd_1_3/http_core.inc b/httpd/httpd_1_3/http_core.inc new file mode 100644 index 000000000..f682cedc8 --- /dev/null +++ b/httpd/httpd_1_3/http_core.inc @@ -0,0 +1,387 @@ +{ Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + } + +{**************************************************************** + * + * The most basic server code is encapsulated in a single module + * known as the core, which is just *barely* functional enough to + * serve documents, though not terribly well. + * + * Largely for NCSA back-compatibility reasons, the core needs to + * make pieces of its config structures available to other modules. + * The accessors are declared here, along with the interpretation + * of one of them (allow_options). + } + +const + OPT_NONE = 0; + OPT_INDEXES = 1; + OPT_INCLUDES = 2; + OPT_SYM_LINKS = 4; + OPT_EXECCGI = 8; + OPT_UNSET = 16; + OPT_INCNOEXEC = 32; + OPT_SYM_OWNER = 64; + OPT_MULTI = 128; + OPT_ALL = (OPT_INDEXES or OPT_INCLUDES or OPT_SYM_LINKS or OPT_EXECCGI); + +{ options for get_remote_host() } +{ REMOTE_HOST returns the hostname, or NULL if the hostname + * lookup fails. It will force a DNS lookup according to the + * HostnameLookups setting. + } + REMOTE_HOST = (0); + +{ REMOTE_NAME returns the hostname, or the dotted quad if the + * hostname lookup fails. It will force a DNS lookup according + * to the HostnameLookups setting. + } + REMOTE_NAME = (1); + +{ REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is + * never forced. + } + REMOTE_NOLOOKUP = (2); + +{ REMOTE_DOUBLE_REV will always force a DNS lookup, and also force + * a double reverse lookup, regardless of the HostnameLookups + * setting. The result is the (double reverse checked) hostname, + * or NULL if any of the lookups fail. + } + REMOTE_DOUBLE_REV = (3); + + SATISFY_ALL = 0; + SATISFY_ANY = 1; + SATISFY_NOSPEC = 2; + +{ default maximum of internal redirects } + AP_DEFAULT_MAX_INTERNAL_REDIRECTS = 20; + +{ default maximum subrequest nesting level } + AP_DEFAULT_MAX_SUBREQ_DEPTH = 20; + +//API_EXPORT(int) ap_allow_options (request_rec *); +//API_EXPORT(int) ap_allow_overrides (request_rec *); +//API_EXPORT(const char *) ap_default_type (request_rec *); +//API_EXPORT(const char *) ap_document_root (request_rec *); { Don't use this! If your request went +// * through a Userdir, or something like +// * that, it'll screw you. But it's +// * back-compatible... +// } +//API_EXPORT(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type); +//API_EXPORT(const char *) ap_get_remote_logname(request_rec *r); + +{ Used for constructing self-referencing URLs, and things like SERVER_PORT, + * and SERVER_NAME. + } +{API_EXPORT(char *) ap_construct_url(pool *p, const char *uri, request_rec *r); +API_EXPORT(const char *) ap_get_server_name(request_rec *r); +API_EXPORT(unsigned) ap_get_server_port(const request_rec *r); +API_EXPORT(unsigned long) ap_get_limit_req_body(const request_rec *r); +API_EXPORT(void) ap_custom_response(request_rec *r, int status, char *string); +API_EXPORT(int) ap_exists_config_define(char *name); +} +{ Check if the current request is beyond the configured max. number of redirects or subrequests + * @param r The current request + * @return true (is exceeded) or false + } +//API_EXPORT(int) ap_is_recursion_limit_exceeded(const request_rec *r); + +{ Authentication stuff. This is one of the places where compatibility + * with the old config files *really* hurts; they don't discriminate at + * all between different authentication schemes, meaning that we need + * to maintain common state for all of them in the core, and make it + * available to the other modules through interfaces. + } + +type + require_line = record + method_mask: cint; + requirement: PChar; + end; + +{API_EXPORT(const char *) ap_auth_type (request_rec *); +API_EXPORT(const char *) ap_auth_name (request_rec *); +API_EXPORT(const char *) ap_auth_nonce (request_rec *); +API_EXPORT(int) ap_satisfies (request_rec *r); +API_EXPORT(const array_header *) ap_requires (request_rec *); } + +{$ifdef WIN32} +{ + * CGI Script stuff for Win32... + } +typedef enum { eFileTypeUNKNOWN, eFileTypeBIN, eFileTypeEXE16, eFileTypeEXE32, + eFileTypeSCRIPT, eCommandShell16, eCommandShell32 } file_type_e; +typedef enum { INTERPRETER_SOURCE_UNSET, INTERPRETER_SOURCE_REGISTRY, + INTERPRETER_SOURCE_SHEBANG } interpreter_source_e; +API_EXPORT(file_type_e) ap_get_win32_interpreter(const request_rec *, char **); +{$endif} + +{.$ifdef CORE_PRIVATE} + +{ + * Core is also unlike other modules in being implemented in more than + * one file... so, data structures are declared here, even though most of + * the code that cares really is in http_core.c. Also, another accessor. + } + +//API_EXPORT(char *) ap_response_code_string (request_rec *r, int error_index); + +//extern API_VAR_EXPORT module core_module; + +{ Per-directory configuration } + +type + allow_options_t = Char; + overrides_t = Char + ; +{ + * Bits of info that go into making an ETag for a file + * document. Why a long? Because char historically + * proved too short for Options, and int can be different + * sizes on different platforms. + } + etag_components_t = culong; + +const + ETAG_UNSET = 0; + ETAG_NONE = (1 shl 0); + ETAG_MTIME = (1 shl 1); + ETAG_INODE = (1 shl 2); + ETAG_SIZE = (1 shl 3); + ETAG_BACKWARD = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE); + ETAG_ALL = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE); + + { Things moved up } + + HOSTNAME_LOOKUP_OFF = 0; + HOSTNAME_LOOKUP_ON = 1; + HOSTNAME_LOOKUP_DOUBLE= 2; + HOSTNAME_LOOKUP_UNSET = 3; + + USE_CANONICAL_NAME_OFF = (0); + USE_CANONICAL_NAME_ON = (1); + USE_CANONICAL_NAME_DNS = (2); + USE_CANONICAL_NAME_UNSET= (3); + + ADD_DEFAULT_CHARSET_OFF = (0); + ADD_DEFAULT_CHARSET_ON = (1); + ADD_DEFAULT_CHARSET_UNSET = (2); + +type + ap_flag_e = ( + AP_FLAG_UNSET = 0, + AP_FLAG_ON = 1, + AP_FLAG_OFF = 2 + ); + + server_signature_t = ( srv_sig_unset, srv_sig_off, srv_sig_on, + srv_sig_withmail); + + + core_dir_config = record + { path of the directory/regex/etc. see also d_is_fnmatch below } + d: PChar; + { the number of slashes in d } + d_components: cuint; + + { If (opts & OPT_UNSET) then no absolute assignment to options has + * been made. + * invariant: (opts_add & opts_remove) == 0 + * Which said another way means that the last relative (options + or -) + * assignment made to each bit is recorded in exactly one of opts_add + * or opts_remove. + } + opts: allow_options_t; + opts_add: allow_options_t; + opts_remove: allow_options_t; + override: overrides_t; + + { MIME typing --- the core doesn't do anything at all with this, + * but it does know what to slap on a request for a document which + * goes untyped by other mechanisms before it slips out the door... + } + + ap_default_type: PChar; + + { Authentication stuff. Groan... } + + satisfy: cint; + ap_auth_type: PChar; + ap_auth_name: PChar; + ap_requires: Parray_header; + + { Custom response config. These can contain text or a URL to redirect to. + * if response_code_strings is NULL then there are none in the config, + * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES. + * This lets us do quick merges in merge_core_dir_configs(). + } + + response_code_strings: PPChar; { from ErrorDocument, not from + * ap_custom_response() + } + + { Hostname resolution etc } + + { Moved Up } + +// unsigned int hostname_lookups : 4; + +// signed int do_rfc1413 : 2; { See if client is advertising a username? } + +// signed int content_md5 : 2; { calculate Content-MD5? } + + { Moved Up } + +// unsigned use_canonical_name : 2; + + { since is_fnmatch(conf->d) was being called so frequently in + * directory_walk() and its relatives, this field was created and + * is set to the result of that call. + } +// unsigned d_is_fnmatch : 1; + + { should we force a charset on any outgoing parameterless content-type? + * if so, which charset? + } + + { Moved up } + +// unsigned add_default_charset : 2; + add_default_charset_name: PChar; + + { System Resource Control } +{$ifdef RLIMIT_CPU} + struct rlimit *limit_cpu; +{$endif} +{$if defined (RLIMIT_DATA) or defined (RLIMIT_VMEM) or defined(RLIMIT_AS)} + struct rlimit *limit_mem; +{$endif} +{$ifdef RLIMIT_NPROC} + struct rlimit *limit_nproc; +{$endif} + limit_req_body: culong; { limit on bytes in request msg body } + + { logging options } + server_signature: server_signature_t; + loglevel: cint; + + { Access control } + sec: Parray_header; + r: Pregex_t; + +{$ifdef WIN32} + { Where to find interpreter to run scripts } + interpreter_source_e script_interpreter_source; +{$endif} + +{$ifdef CHARSET_EBCDIC} + { Configurable EBCDIC Conversion stuff } + { Direction specific conversion: } +#define dir_Out 0 { 0utput (returned contents in a GET or POST) } +#define dir_In 1 { 1nput (uploaded contents in a PUT / POST) } + + { Conversion Enabled/Disabled: } +#define conv_Unset '?' { Conversion unconfigured } +#define conv_Off '0' { BINARY or ASCII file (no conversion) } +#define conv_On '1' { TEXT file (EBCDIC->ASCII for dir_Out; ASCII->EBCDIC for dir_In) } + + { The configuration args {On|Off}[={In|Out|InOut}] are currently stored + * as character strings ("0" = conv_Off, "1" = conv_On) + } + ebcdicconversion_by_ext_in: Ptable; + ebcdicconversion_by_ext_out: Ptable; + ebcdicconversion_by_type_in: Ptable; + ebcdicconversion_by_type_out: Ptable; + +#define LEGACY_KLUDGE 1 { After a couple of versions this legacy kludge should be set to 0 } +#ifndef ASCIITEXT_MAGIC_TYPE_PREFIX +#define ASCIITEXT_MAGIC_TYPE_PREFIX "text/x-ascii-" { Text files whose content-type starts with this are passed thru unconverted } +#endif + int x_ascii_magic_kludge; { whether to handle the text/x-ascii- kludge } + +#if ADD_EBCDICCONVERT_DEBUG_HEADER + int ebcdicconversion_debug_header; { whether to add an X-EBCDIC-Debug-{In,Out} header to the response } +#endif +{$endif} { CHARSET_EBCDIC } + + { + * What attributes/data should be included in ETag generation? + } + etag_bits: etag_components_t; + etag_add: etag_components_t; + etag_remove: etag_components_t; + + { + * Do we allow ISINDEX CGI scripts to pass their query argument as + * direct command line parameters or argv elements? + } + cgi_command_args: ap_flag_e; + + { Digest auth. } + ap_auth_nonce: PChar; + + end; + +{ Per-server core configuration } + +type + core_server_config = record + +{$ifdef GPROF} + gprof_dir: PChar; +{$endif} + + { Name translations --- we want the core to be able to do *something* + * so it's at least a minimally functional web server on its own (and + * can be tested that way). But let's keep it to the bare minimum: + } + ap_document_root: PChar; + + { Access control } + + access_name: PChar; + sec: Parray_header; + sec_url: Parray_header; + + { recursion backstopper } + recursion_limit_set: cint; { boolean } + redirect_limit: cint; { maximum number of internal redirects } + subreq_limit: cint; { maximum nesting level of subrequests } + + { TRACE control } + trace_enable: cint; { see AP_TRACE_ below } + + end; + +{ trace_enable options } +const + AP_TRACE_UNSET =-1; + AP_TRACE_DISABLE = 0; + AP_TRACE_ENABLE = 1; + AP_TRACE_EXTENDED = 2; + +{ for http_config.c } +//CORE_EXPORT(void) ap_core_reorder_directories(pool *, server_rec *); + +{ for mod_perl } +//CORE_EXPORT(void) ap_add_per_dir_conf (server_rec *s, void *dir_config); +//CORE_EXPORT(void) ap_add_per_url_conf (server_rec *s, void *url_config); +//CORE_EXPORT(void) ap_add_file_conf(core_dir_config *conf, void *url_config); +//CORE_EXPORT_NONSTD(const char *) ap_limit_section (cmd_parms *cmd, void *dummy, const char *arg); + +{.$endif} + diff --git a/httpd/httpd_1_3/http_vhost.inc b/httpd/httpd_1_3/http_vhost.inc new file mode 100644 index 000000000..b718033b3 --- /dev/null +++ b/httpd/httpd_1_3/http_vhost.inc @@ -0,0 +1,42 @@ +{ Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + } + +{ called before any config is read } +//API_EXPORT(void) ap_init_vhost_config(pool *p); + +{ called after the config has been read } +//API_EXPORT(void) ap_fini_vhost_config(pool *p, server_rec *main_server); + +{ handle addresses in statement } +//API_EXPORT(const char *) ap_parse_vhost_addrs(pool *p, const char *hostname, server_rec *s); + +{ handle NameVirtualHost directive } +//API_EXPORT_NONSTD(const char *) ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *arg); + +{ given an ip address only, give our best guess as to what vhost it is } +//API_EXPORT(void) ap_update_vhost_given_ip(conn_rec *conn); + +{ The above is never enough, and this is always called after the headers + * have been read. It may change r->server. + } +//API_EXPORT(void) ap_update_vhost_from_headers(request_rec *r); + +{ return 1 if the host:port matches any of the aliases of r->server + * return 0 otherwise + } +//API_EXPORT(int) ap_matches_request_vhost(request_rec *r, const char *host, +// unsigned port); + diff --git a/httpd/httpd_1_3/util_uri.inc b/httpd/httpd_1_3/util_uri.inc new file mode 100644 index 000000000..e12887a21 --- /dev/null +++ b/httpd/httpd_1_3/util_uri.inc @@ -0,0 +1,84 @@ +{ Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + } + +{ + * util_uri.h: External Interface of util_uri.c + } + +type + schemes_t = record + name: PChar; + default_port: cushort; + end; + +const + DEFAULT_FTP_DATA_PORT = 20; + DEFAULT_FTP_PORT = 21; + DEFAULT_GOPHER_PORT = 70; + DEFAULT_NNTP_PORT = 119; + DEFAULT_WAIS_PORT = 210; + DEFAULT_SNEWS_PORT = 563; + DEFAULT_PROSPERO_PORT = 1525; { WARNING: conflict w/Oracle } + + DEFAULT_URI_SCHEME = 'http'; + +{ Flags passed to unparse_uri_components(): } + UNP_OMITSITEPART = (1 shl 0); { suppress "scheme://user@site:port" } + UNP_OMITUSER = (1 shl 1); { Just omit user } + UNP_OMITPASSWORD = (1 shl 2); { Just omit password } + UNP_OMITUSERINFO = (UNP_OMITUSER or UNP_OMITPASSWORD); { omit "user:password@" part } + UNP_REVEALPASSWORD = (1 shl 3); { Show plain text password (default: show XXXXXXXX) } + UNP_OMITPATHINFO = (1 shl 4); { Show "scheme://user@site:port" only } + UNP_OMITQUERY = (1 shl 5); { Omit the "?queryarg" from the path } + +type + hostent = record end; + Phostent = ^hostent; + + uri_components = record + scheme: PChar; { scheme ("http"/"ftp"/...) } + hostinfo: PChar; { combined [user[:password]@]host[:port] } + user: PChar; { user name, as in http://user:passwd@host:port/ } + password: PChar; { password, as in http://user:passwd@host:port/ } + hostname: PChar; { hostname from URI (or from Host: header) } + port_str: PChar; { port string (integer representation is in "port") } + path: PChar; { the request path (or "/" if only scheme://host was given) } + query: PChar; { Everything after a '?' in the path, if present } + fragment: PChar; { Trailing "#fragment" string, if present } + + hostent: Phostent; + + port: cushort; { The port number, numeric, valid only if port_str != NULL } + +// unsigned is_initialized:1; + +// unsigned dns_looked_up:1; +// unsigned dns_resolved:1; + + end; + +{ util_uri.c } +{API_EXPORT(unsigned short) ap_default_port_for_scheme(const char *scheme_str); +API_EXPORT(unsigned short) ap_default_port_for_request(const request_rec *r); +API_EXPORT(struct hostent *) ap_pduphostent(pool *p, const struct hostent *hp); +API_EXPORT(struct hostent *) ap_pgethostbyname(pool *p, const char *hostname); +API_EXPORT(char *) ap_unparse_uri_components(pool *p, const uri_components *uptr, + unsigned flags); +API_EXPORT(int) ap_parse_uri_components(pool *p, const char *uri, uri_components *uptr); +API_EXPORT(int) ap_parse_hostinfo_components(pool *p, const char *hostinfo, uri_components *uptr);} +{ called by the core in main() } +//extern void ap_util_uri_init(void); + diff --git a/httpd/mod_hello.lpi b/httpd/mod_hello.lpi index fdb4be189..aff73dfc0 100644 --- a/httpd/mod_hello.lpi +++ b/httpd/mod_hello.lpi @@ -1,36 +1,16 @@ - + - + - - - - - - - - - - - - - - - - - - - - @@ -38,10 +18,10 @@ - + - + @@ -49,7 +29,7 @@ - + @@ -60,693 +40,697 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + +