From 4ae36cf54e2b5a3cb8354eb7c9aa66c7935f1d3d Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Wed, 4 Oct 2006 02:47:55 +0000 Subject: [PATCH] Many 1.3 improvements git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@25 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- httpd/httpd_1_3/ap.inc | 66 +- httpd/httpd_1_3/ap_alloc.inc | 61 +- httpd/httpd_1_3/ap_config.inc | 124 +-- httpd/httpd_1_3/buff.inc | 67 +- httpd/httpd_1_3/http_config.inc | 32 +- httpd/httpd_1_3/http_core.inc | 53 +- httpd/httpd_1_3/http_log.inc | 2 + httpd/httpd_1_3/http_main.inc | 63 +- httpd/httpd_1_3/http_protocol.inc | 67 +- httpd/httpd_1_3/http_request.inc | 46 +- httpd/httpd_1_3/http_vhost.inc | 23 +- httpd/httpd_1_3/httpd.inc | 33 +- httpd/httpd_1_3/httpd.pas | 4 - httpd/httpd_1_3/win32_os.inc | 191 ++++ httpd/mod_hello.lpi | 1647 ++++++++++++++++------------- httpd/mod_hello.lpr | 2 +- 16 files changed, 1551 insertions(+), 930 deletions(-) create mode 100644 httpd/httpd_1_3/win32_os.inc diff --git a/httpd/httpd_1_3/ap.inc b/httpd/httpd_1_3/ap.inc index 72e9568b1..6da834dbe 100644 --- a/httpd/httpd_1_3/ap.inc +++ b/httpd/httpd_1_3/ap.inc @@ -20,15 +20,20 @@ * 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);} +function ap_cpystrn(param1: PChar; const param2: PChar; param3: size_t): PChar; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; -{$ifndef ap_strtol} -//API_EXPORT(long) ap_strtol(const char *nptr, char **endptr, int base); -{$endif} +{int ap_slack(int, int); +int ap_execle(const char *, const char *, ...); +int ap_execve(const char *, char * const argv[], char * const envp[]); } + +//function ap_getpass(const prompt: PChar; pwbuf: PChar; bufsiz: size_t): cint; +// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +//{$ifndef ap_strtol} +//function ap_strtol(const nptr: PChar; endptr: PPChar; base: cint): clong; +// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; +//{$endif} { small utility macros to make things easier to read } @@ -96,9 +101,14 @@ type curpos: PChar; endpos: PChar; end; + + Pap_vformatter_buff = ^ap_vformatter_buff; + + flush_func_t = function (param: Pap_vformatter_buff): cint; -//API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff *), -// ap_vformatter_buff *, const char *fmt, va_list ap); +function ap_vformatter(flush_func: flush_func_t; + param2: Pap_vformatter_buff; const fmt: PChar; ap: va_list): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { These are snprintf implementations based on ap_vformatter(). * @@ -117,10 +127,14 @@ type * * In no event does ap_snprintf return a negative number. } -//API_EXPORT_NONSTD(int) ap_snprintf(char *buf, size_t len, const char *format,...) +function ap_snprintf(buf: PChar; len: size_t; const format: PChar; + others: array of const): cint; cdecl; external LibHTTPD; + // __attribute__((format(printf,3,4))); -//API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format, -// va_list ap); + +function ap_vsnprintf(buf: PChar; len: size_t; const format: PChar; ap: va_list): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + { Simple BASE64 encode/decode functions. * * As we might encode binary strings, hence we require the length of @@ -133,17 +147,29 @@ type * 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); +function ap_base64encode_len(len: cint): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; -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);} +function ap_base64encode(coded_dst: PChar; const plain_src: PChar; len_plain_src: cint): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_base64encode_binary(coded_dst: PChar; const plain_src: PChar; len_plain_src: cint): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + + +function ap_base64decode_len(const coded_src: PChar): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_base64decode(plain_dst: PChar; const coded_src: PChar): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_base64decode_binary(plain_dst: PChar; const coded_src: PChar): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { 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); +function ap_validate_password(const passwd, hash: PChar): PChar; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; diff --git a/httpd/httpd_1_3/ap_alloc.inc b/httpd/httpd_1_3/ap_alloc.inc index 6221320af..5809d009e 100644 --- a/httpd/httpd_1_3/ap_alloc.inc +++ b/httpd/httpd_1_3/ap_alloc.inc @@ -46,10 +46,17 @@ type 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 *); +function ap_init_alloc: PPool; { Set up everything } + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +//procedure ap_cleanup_alloc; +// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_make_sub_pool(param: PPool): PPool; { All pools are subpools of permanent_pool } + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_destroy_pool(param: PPool); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { pools have nested lifetimes -- sub_pools are destroyed when the * parent pool is cleared. We allow certain liberties with operations @@ -98,21 +105,32 @@ type { Clearing out EVERYTHING in an pool... destroys any sub-pools } -procedure ap_clear_pool(param1: Ppool); cdecl; external LibHTTPD; +procedure ap_clear_pool(param1: Ppool); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} 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); +procedure ap_cleanup_for_exec; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { 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); +function ap_palloc(p: PPool; nbytes: cint): Pointer; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_pcalloc(p: PPool; nbytes: cint): Pointer; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_pstrdup(p: PPool; const s: Char): PChar; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + { make a nul terminated copy of the n characters starting with s } -//API_EXPORT(char *) ap_pstrndup(struct pool *, const char *s, int n); + +function ap_pstrndup(p: PPool; const s: PChar; n: cint): PChar; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + //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))); @@ -145,8 +163,8 @@ type * 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); +function ap_array_pstrcat(p: PPool; const arr: Parray_header; const sep: Char): PChar; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { copy_array copies the *entire* array. copy_array_hdr just copies * the header, and arranges for the elements to be copied if (and only @@ -221,7 +239,9 @@ API_EXPORT(table * ) ap_overlay_tables(pool *p, const table *overlay, const tabl const AP_OVERLAP_TABLES_SET = (0); AP_OVERLAP_TABLES_MERGE = (1); -//API_EXPORT(void) ap_overlap_tables(table *a, const table *b, unsigned flags); + +procedure ap_overlap_tables(a: Ptable; const b: Ptable; flags: cuint); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { 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 @@ -282,8 +302,11 @@ const * up with timeout handling in general... } -//API_EXPORT(void) ap_block_alarms(void); -//API_EXPORT(void) ap_unblock_alarms(void); +procedure ap_block_alarms; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_unblock_alarms; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { Common cases which want utility support.. * the note_cleanups_for_foo routines are for @@ -347,7 +370,6 @@ type 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 *), @@ -365,6 +387,9 @@ const { Finally, some accounting } -//API_EXPORT(long) ap_bytes_in_pool(pool *p); -//API_EXPORT(long) ap_bytes_in_free_blocks(void); +function ap_bytes_in_pool(p: PPool): culong; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_bytes_in_free_blocks: culong; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; diff --git a/httpd/httpd_1_3/ap_config.inc b/httpd/httpd_1_3/ap_config.inc index a01876e4b..9ba30b121 100644 --- a/httpd/httpd_1_3/ap_config.inc +++ b/httpd/httpd_1_3/ap_config.inc @@ -28,10 +28,10 @@ //#include "ap_config_auto.h" //#endif -{.$if defined(WIN32) or defined(NETWARE)} -{ not available under WIN32, so provide important entries manually } -{.$undefine HAVE_UNISTD_H} -//#endif +{$if defined(WIN32) or defined(NETWARE)} + { not available under WIN32, so provide important entries manually } + {$undefine HAVE_UNISTD_H} +{$endif} { Have to include sys/stat.h before ../win32/os.h so we can override stat() properly } @@ -68,11 +68,11 @@ stat() properly } { Define one of these according to your system. } {$if defined(MINT)} -typedef int rlim_t; +type rlim_t = cint; #define JMP_BUF sigjmp_buf -#define NO_LONG_DOUBLE -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define _BSD_SOURCE +{$define NO_LONG_DOUBLE} +{$define HAVE_FLOCK_SERIALIZED_ACCEPT} +{$define _BSD_SOURCE} #define EAGAIN EWOULDBLOCK int initgroups (char *, int); char *crypt (const char *pw, const char *salt); @@ -80,11 +80,11 @@ int gethostname (char *name, int namelen); {$else}{$if defined(MPE)} #include -#define NO_SETSID -#define NO_KILLPG -#define NO_WRITEV +{$define NO_SETSID} +{$define NO_KILLPG} +{$define NO_WRITEV} #define HAVE_SHMGET 1 -#define USE_SHMGET_SCOREBOARD} +{$define USE_SHMGET_SCOREBOARD} { UID/GID isn't a native concept for MPE, and it's definitely not a 100% Unix implementation. There isn't a traditional superuser concept either, @@ -96,37 +96,38 @@ int gethostname (char *name, int namelen); const SHM_R = 0440; { Read permission } SHM_W = 0220; { Write permission } -{$define NEED_INITGROUPS} -{$define NEED_STRCASECMP} -{$define NEED_STRDUP} -{$define NEED_STRNCASECMP} + {$define NEED_INITGROUPS} + {$define NEED_STRCASECMP} + {$define NEED_STRDUP} + {$define NEED_STRNCASECMP} //extern void GETPRIVMODE(); //extern void GETUSERMODE(); //extern char *inet_ntoa(); -//{$define NO_SLACK + {$define NO_SLACK} S_IEXEC = S_IXUSR; S_IREAD = S_IRUSR; S_IWRITE = S_IWUSR; PF_INET = AF_INET; -//#define HAVE_FCNTL_SERIALIZED_ACCEPT + {$define HAVE_FCNTL_SERIALIZED_ACCEPT} {$else}{$if defined(SUNOS4)} -#define HAVE_GMTOFF 1 -#undef NO_KILLPG +const + HAVE_GMTOFF = 1; +{$undefine NO_KILLPG} #undef NO_SETSID -char *crypt(const char *pw, const char *salt); -char *mktemp(char *); -#define HAVE_MMAP 1 -#define USE_MMAP_SCOREBOARD -#define USE_MMAP_FILES +//char *crypt(const char *pw, const char *salt); +//char *mktemp(char *); + HAVE_MMAP = 1; +{$define USE_MMAP_SCOREBOARD} +{$define USE_MMAP_FILES} #include -#define NEED_STRERROR -typedef int rlim_t; +{$define NEED_STRERROR} +type rlim_t = cint; #define memmove(a,b,c) bcopy(b,a,c) -#define NO_LINGCLOSE -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define NEED_DIFFTIME -#define HAVE_SYSLOG 1 +{$define NO_LINGCLOSE} +{$define HAVE_FLOCK_SERIALIZED_ACCEPT} +{$define NEED_DIFFTIME} + HAVE_SYSLOG = 1; {$else}{$if defined(SOLARIS2)} #undef HAVE_GMTOFF @@ -392,25 +393,25 @@ typedef int pid_t; #endif {$else}{$if defined(DARWIN)} { Darwin (Mac OS) } -#undef PLATFORM -#define PLATFORM "Darwin" -#define HAVE_DYLD -#define HAVE_GMTOFF -#define HAVE_MMAP -#define USE_MMAP_FILES -#define USE_MMAP_SCOREBOARD -#ifdef MAC_OS_X_SERVER -#define MAP_TMPFILE -#endif { MAC_OS_X_SERVER } -#define HAVE_RESOURCE -#define HAVE_SNPRINTF -#define JMP_BUF jmp_buf -#define USE_LONGJMP -#define HAVE_FLOCK_SERIALIZED_ACCEPT -#define HAVE_FCNTL_SERIALIZED_ACCEPT -#define USE_FLOCK_SERIALIZED_ACCEPT -#define SINGLE_LISTEN_UNSERIALIZED_ACCEPT -#define AP_ENABLE_EXCEPTION_HOOK +const + PLATFORM = 'Darwin'; +{$define HAVE_DYLD} +{$define HAVE_GMTOFF} +{$define HAVE_MMAP} +{$define USE_MMAP_FILES} +{$define USE_MMAP_SCOREBOARD} +{$ifdef MAC_OS_X_SERVER} + {$define MAP_TMPFILE} +{$endif} { MAC_OS_X_SERVER } +{$define HAVE_RESOURCE} +{$define HAVE_SNPRINTF} +{$define JMP_BUF jmp_buf} +{$define USE_LONGJMP} +{$define HAVE_FLOCK_SERIALIZED_ACCEPT} +{$define HAVE_FCNTL_SERIALIZED_ACCEPT} +{$define USE_FLOCK_SERIALIZED_ACCEPT} +{$define SINGLE_LISTEN_UNSERIALIZED_ACCEPT} +{$define AP_ENABLE_EXCEPTION_HOOK} {$else}{$if defined(LINUX)} @@ -506,12 +507,10 @@ typedef int rlim_t; #undef NO_KILLPG #undef NO_SETSID #undef NEED_STRDUP -#define HAVE_SYSLOG 1 +const + HAVE_SYSLOG = 1; -#ifdef PLATFORM -#undef PLATFORM -#endif -#define PLATFORM "AtheOS" + PLATFORM = 'AtheOS'; {$else}{$if defined(SCO5)} @@ -900,6 +899,8 @@ typedef int rlim_t; { All windows stuff is now in os/win32/os.h } +{$include win32_os.inc} + {$else}{$if defined(TPF)} { IBM Transaction Processing Facility operating system } { All TPF definitions are now in os/tpf/os.h } @@ -1393,9 +1394,7 @@ extern int ap_execve(const char *filename, char * const argv[], * NET_SIZE_T should be defined to be an int, unless the system being compiled * for was created in the window of POSIX madness. } -//#ifndef NET_SIZE_T -//#define NET_SIZE_T int -//#endif +type NET_SIZE_T = cint; { Linux defines __WCOREDUMP, but doesn't define WCOREDUMP unless __USE_BSD * is in use... we'd prefer to just use WCOREDUMP everywhere. @@ -1488,9 +1487,10 @@ extern char *strerror (int err); #endif #ifdef NEED_DIFFTIME extern double difftime(time_t time1, time_t time0); -#endif - -#ifndef ap_wait_t -#define ap_wait_t int #endif} +{$ifndef ap_wait_t} +type + ap_wait_t = cint; +{$endif} + diff --git a/httpd/httpd_1_3/buff.inc b/httpd/httpd_1_3/buff.inc index d4e4f9eab..a5f2b673e 100644 --- a/httpd/httpd_1_3/buff.inc +++ b/httpd/httpd_1_3/buff.inc @@ -20,6 +20,7 @@ //#include +const { Reading is buffered } B_RD = (1); { Writing is buffered } @@ -53,6 +54,8 @@ type PBUFF = Pbuff_struct; + PPBUFF = ^PBUFF; + error_t = procedure (fb: PBUFF; op: cint; data: Pointer); filter_callback_t = procedure (param1: PBUFF; const param2: Pointer; param3: cint); @@ -107,25 +110,43 @@ 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);} + +function ap_bcreate(p: PPool; flags: cint): PBUFF; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_bpushfd(fb: PBUFF; fd_in, fd_out: cint); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +{$ifdef WIN32} + +procedure ap_bpushh(fb: PBUFF; hFH: HANDLE); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +{$endif} + +function ap_bsetopt(fb: PBUFF; optname: cint; const optval: Pointer): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_bgetopt(fb: PBUFF; optname: cint; optval: Pointer): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_bsetflag(fb: PBUFF; flag, value: cint): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_bclose(fb: PBUFF): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; //#define ap_bgetflag(fb, flag) ((fb)->flags & (flag)) { Error handling } -//API_EXPORT(void) ap_bonerror(BUFF *fb, void (*error) (BUFF *, int, void *), -// void *data); + +procedure ap_bonerror(fb: PBUFF; error: error_t; data: Pointer); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { I/O } -{API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte); -API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb); +function ap_bread(fb: PBUFF; buf: Pointer; nbyte: cint): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; +{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); @@ -183,17 +204,25 @@ type 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); + + Pchild_info = ^child_info; + + func_t = function (param1: Pointer; param2: Pchild_info): cint; + +function ap_bspawn_child(p: PPool; + func: func_t; data: Pointer; kill_how: kill_conditions; pipe_in, pipe_out, pipe_err: PPBUFF): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { enable non-blocking operations } -//API_EXPORT(int) ap_bnonblock(BUFF *fb, int direction); +function ap_bnonblock(fb: PBUFF; direction: cint): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { and get an fd to select() on } -//API_EXPORT(int) ap_bfileno(BUFF *fb, int direction); +function ap_bfileno(fb: PBUFF; direction: cint): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { bflush() if a read now would block, but don't actually read anything } -//API_EXPORT(void) ap_bhalfduplex(BUFF *fb); +procedure ap_bhalfduplex(fb: PBUFF); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; {$if defined(WIN32) or defined(NETWARE) or defined(CYGWIN_WINSOCK)} diff --git a/httpd/httpd_1_3/http_config.inc b/httpd/httpd_1_3/http_config.inc index 260fb4152..f90db9043 100644 --- a/httpd/httpd_1_3/http_config.inc +++ b/httpd/httpd_1_3/http_config.inc @@ -45,11 +45,11 @@ type TAKE13 { one or three arguments } ); - func_t = function (): PChar; + cs_func_t = function (): PChar; command_struct = record name: PChar; { Name of this command } - func: func_t; { Function invoked } + func: cs_func_t; { Function invoked } cmd_data: Pointer; { Extra data, for functions which * implement multiple commands... } @@ -302,14 +302,26 @@ API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *, char *, char *);} { 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);} +procedure ap_add_module(m: Pmodule); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_remove_module(m: Pmodule); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_add_loaded_module(m: Pmodule); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_add_named_module(const name: PChar): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_clear_module_list(); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_find_module_name(m: Pmodule): PChar; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_find_linked_module(const name: PChar): Pmodule; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { for implementing subconfigs and customized config files } {API_EXPORT(const char *) ap_srm_command_loop(cmd_parms *parms, void *config); diff --git a/httpd/httpd_1_3/http_core.inc b/httpd/httpd_1_3/http_core.inc index 8a84fdcda..f921ac26c 100644 --- a/httpd/httpd_1_3/http_core.inc +++ b/httpd/httpd_1_3/http_core.inc @@ -129,7 +129,8 @@ type interpreter_source_e = ( INTERPRETER_SOURCE_UNSET, INTERPRETER_SOURCE_REGISTRY, INTERPRETER_SOURCE_SHEBANG ); -//API_EXPORT(file_type_e) ap_get_win32_interpreter(const request_rec *, char **); +function ap_get_win32_interpreter(const param1: Prequest_rec; param2: PPChar): file_type_e; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; {$endif} {.$ifdef CORE_PRIVATE} @@ -183,6 +184,23 @@ const ADD_DEFAULT_CHARSET_ON = (1); ADD_DEFAULT_CHARSET_UNSET = (2); +{$ifdef CHARSET_EBCDIC} + + { Configurable EBCDIC Conversion stuff } + { Direction specific conversion: } + dir_Out = 0; { 0utput (returned contents in a GET or POST) } + dir_In = 1; { 1nput (uploaded contents in a PUT / POST) } + + { Conversion Enabled/Disabled: } + conv_Unset = '?'; { Conversion unconfigured } + conv_Off = '0'; { BINARY or ASCII file (no conversion) } + conv_On = '1'; { TEXT file (EBCDIC->ASCII for dir_Out; ASCII->EBCDIC for dir_In) } + + LEGACY_KLUDGE = 1; { After a couple of versions this legacy kludge should be set to 0 } + ASCIITEXT_MAGIC_TYPE_PREFIX = 'text/x-ascii-'; { Text files whose content-type starts with this are passed thru unconverted } + +{$endif} + type ap_flag_e = ( AP_FLAG_UNSET = 0, @@ -210,7 +228,7 @@ type opts: allow_options_t; opts_add: allow_options_t; opts_remove: allow_options_t; - override: overrides_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 @@ -267,13 +285,13 @@ type { System Resource Control } {$ifdef RLIMIT_CPU} - struct rlimit *limit_cpu; + limit_cpu: Prlimit; {$endif} -{$if defined (RLIMIT_DATA) or defined (RLIMIT_VMEM) or defined(RLIMIT_AS)} - struct rlimit *limit_mem; +{$if defined(RLIMIT_DATA) or defined(RLIMIT_VMEM) or defined(RLIMIT_AS)} + limit_mem: Prlimit; {$endif} {$ifdef RLIMIT_NPROC} - struct rlimit *limit_nproc; + limit_nproc: Prlimit; {$endif} limit_req_body: culong; { limit on bytes in request msg body } @@ -291,15 +309,8 @@ type {$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) } + { Moved up } { The configuration args {On|Off}[={In|Out|InOut}] are currently stored * as character strings ("0" = conv_Off, "1" = conv_On) @@ -309,15 +320,13 @@ type 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 } + { Moved up } + + x_ascii_magic_kludge: cint; { 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 +{$ifdef ADD_EBCDICCONVERT_DEBUG_HEADER} + ebcdicconversion_debug_header: cint; { whether to add an X-EBCDIC-Debug-{In,Out} header to the response } +{$endif} {$endif} { CHARSET_EBCDIC } { diff --git a/httpd/httpd_1_3/http_log.inc b/httpd/httpd_1_3/http_log.inc index 2245f15e2..b368f9831 100644 --- a/httpd/httpd_1_3/http_log.inc +++ b/httpd/httpd_1_3/http_log.inc @@ -107,6 +107,8 @@ type // FILE *write_f; //#endif end; + + Ppiped_log = ^piped_log; procedure ap_open_piped_log(p: PPool; const program_: PChar); {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; diff --git a/httpd/httpd_1_3/http_main.inc b/httpd/httpd_1_3/http_main.inc index ade0bb950..10547159a 100644 --- a/httpd/httpd_1_3/http_main.inc +++ b/httpd/httpd_1_3/http_main.inc @@ -67,21 +67,46 @@ procedure ap_start_shutdown(); {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; -{API_EXPORT(void) ap_start_restart(int); -API_EXPORT(void) ap_hard_timeout(char *, request_rec *); -API_EXPORT(void) ap_keepalive_timeout(char *, request_rec *); -API_EXPORT(void) ap_soft_timeout(char *, request_rec *); -API_EXPORT(void) ap_kill_timeout(request_rec *); -API_EXPORT(void) ap_reset_timeout(request_rec *); +procedure ap_start_restart(param: cint); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; -API_EXPORT(void) ap_child_terminate(request_rec *r); -API_EXPORT(void) ap_sync_scoreboard_image(void); -API_EXPORT(int) ap_update_child_status(int child_num, int status, request_rec *r); -void ap_time_process_request(int child_num, int status); -API_EXPORT(unsigned int) ap_set_callback_and_alarm(void ( *fn) (int), int x); -API_EXPORT(int) ap_check_alarm(void); +procedure ap_hard_timeout(p: PChar; r: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; -void setup_signal_names(char *prefix);} +procedure ap_keepalive_timeout(p: PChar; r: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_soft_timeout(p: PChar; r: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_kill_timeout(r: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_reset_timeout(r: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + + +//procedure ap_child_terminate(r: Prequest_rec); +// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_sync_scoreboard_image(); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_update_child_status(child_num, status: cint; r: Prequest_rec): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +{ void ap_time_process_request(int child_num, int status); } + +type + fn_t = procedure (param: cint); + +function ap_set_callback_and_alarm(fn: fn_t; x: cint): cuint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_check_alarm(): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +{ void setup_signal_names(char *prefix);} { functions for determination and setting of accept() mutexing } {char *ap_default_mutex_method(void); @@ -102,9 +127,12 @@ char *ap_init_mutex_method(char *t);} * This is useful for log pipe children, to know when they've blocked. To * disable this feature, use -1 for write_fd. } -//API_EXPORT(void) ap_register_other_child(int pid, -// void ( *maintenance) (int reason, void *data, ap_wait_t status), void *data, -// int write_fd); +type + maintenance_t = procedure (reason: cint; data: Pointer; status: ap_wait_t); + +procedure ap_register_other_child(pid: cint; + maintenance: maintenance_t; data: Pointer; write_fd: cint); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; const OC_REASON_DEATH = 0; { child has died, caller must call @@ -125,7 +153,8 @@ const * is assumed to be unique' per other_child. This is because the pid and * write_fd are possibly killed off separately. } -//API_EXPORT(void) ap_unregister_other_child(void *data); +procedure ap_unregister_other_child(data: Pointer); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; {$endif} diff --git a/httpd/httpd_1_3/http_protocol.inc b/httpd/httpd_1_3/http_protocol.inc index 943e3eaaf..733f05b63 100644 --- a/httpd/httpd_1_3/http_protocol.inc +++ b/httpd/httpd_1_3/http_protocol.inc @@ -72,13 +72,26 @@ procedure ap_send_error_response(r: Prequest_rec; recursive_error: cint); * permit_cache argument is set to one). } -{API_EXPORT(int) ap_set_content_length(request_rec *r, long length); -API_EXPORT(int) ap_set_keepalive(request_rec *r); -API_EXPORT(time_t) ap_rationalize_mtime(request_rec *r, time_t mtime); -API_EXPORT(char *) ap_make_etag(request_rec *r, int force_weak); -API_EXPORT(void) ap_set_etag(request_rec *r); -API_EXPORT(void) ap_set_last_modified(request_rec *r); -API_EXPORT(int) ap_meets_conditions(request_rec *r);} +function ap_set_content_length(r: Prequest_rec; length: clong): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_set_keepalive(r: Prequest_rec): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_rationalize_mtime(r: Prequest_rec; mtime: time_t): time_t; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_make_etag(r: Prequest_rec; force_weak: cint): PChar; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_set_etag(r: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_set_last_modified(r: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_meets_conditions(r: Prequest_rec): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { Other ways to send stuff at the client. All of these keep track * of bytes_sent automatically. This indirection is intended to make @@ -91,14 +104,20 @@ API_EXPORT(int) ap_meets_conditions(request_rec *r);} * (Ditto the send_header stuff). } -{API_EXPORT(long) ap_send_fd(FILE *f, request_rec *r); -API_EXPORT(long) ap_send_fd_length(FILE *f, request_rec *r, long length); +//function ap_send_fd(f: PFILE; r: Prequest_rec): clong; +// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; -API_EXPORT(long) ap_send_fb(BUFF *f, request_rec *r); -API_EXPORT(long) ap_send_fb_length(BUFF *f, request_rec *r, long length); +//function ap_send_fd_length(f: PFILE; r: Prequest_rec; length: clong): clong; +// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; -API_EXPORT(size_t) ap_send_mmap(void *mm, request_rec *r, size_t offset, - size_t length);} +function ap_send_fb(f: PBUFF; r: Prequest_rec): clong; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_send_fb_length(f: PBUFF; r: Prequest_rec): clong; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_send_mmap(mm: Pointer; r: Prequest_rec; offset, length: size_t): size_t; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { Hmmm... could macrofy these for now, and maybe forever, though the * definitions of the macros would get a whole lot hairier. @@ -137,15 +156,25 @@ function ap_index_of_response(status: cint): cint; { Reading a block of data from the client connection (e.g., POST arg) } -{API_EXPORT(int) ap_setup_client_block(request_rec *r, int read_policy); -API_EXPORT(int) ap_should_client_block(request_rec *r); -API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz); -API_EXPORT(int) ap_discard_request_body(request_rec *r);} +function ap_setup_client_block(r: Prequest_rec; read_policy: cint): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_should_client_block(r: Prequest_rec): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_get_client_block(r: Prequest_rec; buffer: PChar; bufsiz: cint): clong; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_discard_request_body(r: Prequest_rec): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { Sending a byterange } -{API_EXPORT(int) ap_set_byterange(request_rec *r); -API_EXPORT(int) ap_each_byterange(request_rec *r, long *offset, long *length);} +function ap_set_byterange(r: Prequest_rec): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_each_byterange(r: Prequest_rec; offset, length: Pclong): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { Support for the Basic authentication protocol. Note that there's * nothing that prevents these from being in mod_auth.c, except that other diff --git a/httpd/httpd_1_3/http_request.inc b/httpd/httpd_1_3/http_request.inc index e36617974..dbc77ea42 100644 --- a/httpd/httpd_1_3/http_request.inc +++ b/httpd/httpd_1_3/http_request.inc @@ -34,15 +34,24 @@ * about which was allocated in its pool elsewhere before doing this. } -{API_EXPORT(request_rec *) ap_sub_req_lookup_uri(const char *new_file, - const request_rec *r); -API_EXPORT(request_rec *) ap_sub_req_lookup_file(const char *new_file, - const request_rec *r); -API_EXPORT(request_rec *) ap_sub_req_method_uri(const char *method, - const char *new_file, - const request_rec *r); -API_EXPORT(int) ap_run_sub_req(request_rec *r); -API_EXPORT(void) ap_destroy_sub_req(request_rec *r);} +function ap_sub_req_lookup_uri(const new_file: PChar; + const r: Prequest_rec): Prequest_rec; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_sub_req_lookup_file(const new_file: PChar; + const r: Prequest_rec): Prequest_rec; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_sub_req_method_uri(const method, new_file: PChar; + const r: Prequest_rec): Prequest_rec; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + + +function ap_run_sub_req(r: Prequest_rec): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_destroy_sub_req(r: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { * Then there's the case that you want some other request to be served @@ -50,11 +59,20 @@ API_EXPORT(void) ap_destroy_sub_req(request_rec *r);} * If so, call this from a handler, and then immediately return OK. } -{API_EXPORT(void) ap_internal_redirect(const char *new_uri, request_rec *); -API_EXPORT(void) ap_internal_redirect_handler(const char *new_uri, request_rec *); -API_EXPORT(int) ap_some_auth_required(request_rec *r); -API_EXPORT(int) ap_is_initial_req(request_rec *r); -API_EXPORT(time_t) ap_update_mtime(request_rec *r, time_t dependency_mtime);} +procedure ap_internal_redirect(const new_uri: PChar; param2: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_internal_redirect_handler(const new_uri: PChar; param2: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_some_auth_required(r: Prequest_rec): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_is_initial_req(r: Prequest_rec): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_update_mtime(r: Prequest_rec; dependency_mtime: time_t): time_t; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; {$ifdef CORE_PRIVATE} { Function called by main.c to handle first-level request } diff --git a/httpd/httpd_1_3/http_vhost.inc b/httpd/httpd_1_3/http_vhost.inc index b718033b3..869738bc0 100644 --- a/httpd/httpd_1_3/http_vhost.inc +++ b/httpd/httpd_1_3/http_vhost.inc @@ -15,28 +15,35 @@ } { called before any config is read } -//API_EXPORT(void) ap_init_vhost_config(pool *p); +procedure ap_init_vhost_config(p: PPool); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { called after the config has been read } -//API_EXPORT(void) ap_fini_vhost_config(pool *p, server_rec *main_server); +procedure ap_fini_vhost_config(p: PPool; main_server: Pserver_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { handle addresses in statement } -//API_EXPORT(const char *) ap_parse_vhost_addrs(pool *p, const char *hostname, server_rec *s); +function ap_parse_vhost_addrs(p: PPool; const hostname: PChar; s: Pserver_rec): PChar; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { handle NameVirtualHost directive } -//API_EXPORT_NONSTD(const char *) ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, char *arg); +//function ap_set_name_virtual_host(cmd: Pcmd_parms; dummy: Pointer; arg: PChar): PChar; +// cdecl; external LibHTTPD; { 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); +procedure ap_update_vhost_given_ip(conn: Pconn_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { 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); +procedure ap_update_vhost_from_headers(r: Prequest_rec); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; { 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); +function ap_matches_request_vhost(r: Prequest_rec; const host: PChar; + port: cuint): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; diff --git a/httpd/httpd_1_3/httpd.inc b/httpd/httpd_1_3/httpd.inc index 33ea06dc8..e7c6a1091 100644 --- a/httpd/httpd_1_3/httpd.inc +++ b/httpd/httpd_1_3/httpd.inc @@ -1049,13 +1049,24 @@ type { Misc system hackery } -{API_EXPORT(uid_t) ap_uname2id(const char *name); -API_EXPORT(gid_t) ap_gname2id(const char *name); -API_EXPORT(int) ap_is_directory(const char *name); -API_EXPORT(int) ap_is_rdirectory(const char *name); -API_EXPORT(int) ap_can_exec(const struct stat *); -API_EXPORT(void) ap_chdir_file(const char *file); -} +function ap_uname2id(const name: PChar): uid_t; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_gname2id(const name: PChar): gid_t; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_is_directory(const name: PChar): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_is_rdirectory(const name: PChar): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +function ap_can_exec(const stat: Pointer): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +procedure ap_chdir_file(const file_: PChar); + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + //#ifndef HAVE_CANONICAL_FILENAME { * We can't define these in os.h because of dependence on pool pointer. @@ -1166,7 +1177,7 @@ API_EXPORT(extern const char *) ap_psignature(const char *prefix, request_rec *r // strtoul = strtoul_is_not_a_portable_function_use_strtol_instead -//#ifdef AP_ENABLE_EXCEPTION_HOOK +{$ifdef AP_ENABLE_EXCEPTION_HOOK} { The exception hook allows a module to run from the server's signal * handler, and perform tasks such as logging the current request or * getting a backtrace or performing other diagnostic functions. All @@ -1190,6 +1201,8 @@ type * If EnableExceptionHook directive is not set to "on", this function will * report failure and no such hooks will be called. } -//API_EXPORT(extern int) ap_add_fatal_exception_hook(void (*fn)(ap_exception_info_t *)); -//#endif { AP_ENABLE_EXCEPTION_HOOK } +function ap_add_fatal_exception_hook(fn: procedure (param: Pap_exception_info_t) ): cint; + {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} external LibHTTPD; + +{$endif} { AP_ENABLE_EXCEPTION_HOOK } diff --git a/httpd/httpd_1_3/httpd.pas b/httpd/httpd_1_3/httpd.pas index 65fdfcd22..9b156502d 100644 --- a/httpd/httpd_1_3/httpd.pas +++ b/httpd/httpd_1_3/httpd.pas @@ -66,12 +66,8 @@ const { Various types} type - uid_t = Integer; - gid_t = Integer; time_t = LongInt; size_t = Integer; - pid_t = Integer; - Ppid_t = ^pid_t; { configuration vector structure } type diff --git a/httpd/httpd_1_3/win32_os.inc b/httpd/httpd_1_3/win32_os.inc new file mode 100644 index 000000000..a72f83737 --- /dev/null +++ b/httpd/httpd_1_3/win32_os.inc @@ -0,0 +1,191 @@ +{ 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 WIN32} + +{ + * Compile the server including all the Windows NT 4.0 header files by + * default. We still want the server to run on Win95/98 so use + * runtime checks before calling NT specific functions to verify we are + * really running on an NT system. + } +const + _WIN32_WINNT = $0400; + +{ If it isn't too late, prevent windows.h from including the original + * winsock.h header, so that we can still include winsock2.h + } +{#if !defined(_WINSOCKAPI_) || !defined(_WINDOWS_) +#define _WINSOCKAPI_ +#include +#include +#include +#else +#include +#endif +#include +#include +#include +#include } + + PLATFORM = 'Win32'; + +{ + * This file in included in all Apache source code. It contains definitions + * of facilities available on _this_ operating system (HAVE_* macros), + * and prototypes of OS specific functions defined in os.c + } + +{ temporarily replace crypt } +{ char *crypt(const char *pw, const char *salt); } +//#define crypt(buf,salt) (buf) + +{ Although DIR_TYPE is dirent (see nt/readdir.h) we need direct.h for + chdir() } +//#include + +{$define STATUS} +{$define STRICT} +{$define CASE_BLIND_FILESYSTEM} +{$define NO_WRITEV} +{$define NO_SETSID} +{$define NO_USE_SIGACTION} +{$define NO_TIMES} +{$define NO_GETTIMEOFDAY} +{$define USE_LONGJMP} +{$define HAVE_MMAP} +{$define USE_MMAP_SCOREBOARD} +{$define MULTITHREAD} +{$define HAVE_CANONICAL_FILENAME} +{$define HAVE_DRIVE_LETTERS} +{$define HAVE_UNC_PATHS} + +type + uid_t = cint; + gid_t = cint; + pid_t = cint; + Ppid_t = ^pid_t; + tid_t = cint; +{$ifdef _MSC_VER} +{ modified to match declaration in sys/stat.h } + mode_t = cushort; +{$endif} + caddr_t = PChar; + +{ +Define export types. API_EXPORT_NONSTD is a nasty hack to avoid having to declare +every configuration function as __stdcall. +} + +{#ifdef SHARED_MODULE +#define API_VAR_EXPORT __declspec(dllimport) +#define API_EXPORT(type) __declspec(dllimport) type __stdcall +#define API_EXPORT_NONSTD(type) __declspec(dllimport) type __cdecl +#else +#define API_VAR_EXPORT __declspec(dllexport) +#define API_EXPORT(type) __declspec(dllexport) type __stdcall +#define API_EXPORT_NONSTD(type) __declspec(dllexport) type __cdecl +#endif +#define MODULE_VAR_EXPORT __declspec(dllexport) + +#define strcasecmp(s1, s2) stricmp(s1, s2) +#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n) +#define lstat(x, y) stat(x, y) +#ifndef S_ISLNK +#define S_ISLNK(m) (0) +#endif +#ifndef S_ISREG +#define S_ISREG(m) ((m & _S_IFREG) == _S_IFREG) +#endif +#ifndef S_ISDIR +#define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR) +#endif +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 +#define JMP_BUF jmp_buf +#define sleep(t) Sleep(t*1000) +#ifndef O_CREAT +#define O_CREAT _O_CREAT +#endif +#ifndef O_RDWR +#define O_RDWR _O_RDWR +#endif +#define SIGPIPE 17} +{ Seems Windows is not a subgenius } +{$define NO_SLACK} +//#include + +{ MSVC asserts that strtol "errno is set to ERANGE + * if overflow or underflow occurs" + * Ergo we can use the library strtol safely. + } +//#define ap_strtol strtol + +{$define NO_OTHER_CHILD} +{$define NO_RELIABLE_PIPED_LOGS} + +//__inline int ap_os_is_path_absolute(const char *file) +{ + For now, just do the same check that http_request.c and mod_alias.c + * do. + + return file && (file[0] == '/' || (file[1] == ':' && file[2] == '/')); +} + +{#define stat(f,ps) os_stat(f,ps) +API_EXPORT(int) os_stat(const char *szPath,struct stat *pStat); + +API_EXPORT(int) os_strftime(char *s, size_t max, const char *format, const struct tm *tm); + +#define _spawnv(mode,cmdname,argv) os_spawnv(mode,cmdname,argv) +#define spawnv(mode,cmdname,argv) os_spawnv(mode,cmdname,argv) +API_EXPORT(int) os_spawnv(int mode,const char *cmdname,const char *const *argv); +#define _spawnve(mode,cmdname,argv,envp) os_spawnve(mode,cmdname,argv,envp) +#define spawnve(mode,cmdname,argv,envp) os_spawnve(mode,cmdname,argv,envp) +API_EXPORT(int) os_spawnve(int mode,const char *cmdname,const char *const *argv,const char *const *envp); +#define _spawnle os_spawnle +#define spawnle os_spawnle +API_EXPORT_NONSTD(int) os_spawnle(int mode,const char *cmdname,...);} + +{ OS-dependent filename routines in util_win32.c } + +//API_EXPORT(int) ap_os_is_filename_valid(const char *file); + +{ Abstractions for dealing with shared object files (DLLs on Win32). + * These are used by mod_so.c + } +{#define ap_os_dso_handle_t HINSTANCE +#define ap_os_dso_init() +#define ap_os_dso_unload(l) FreeLibrary(l) +#define ap_os_dso_sym(h,s) GetProcAddress(h,s) + +API_EXPORT(ap_os_dso_handle_t) ap_os_dso_load(const char *); +API_EXPORT(const char *) ap_os_dso_error(void);} + +{ Other ap_os_ routines not used by this platform } +//#define ap_os_kill(pid, sig) kill(pid, sig) + +{ Some Win32isms } +{$define HAVE_ISNAN} +//#define isnan(n) _isnan(n) +{$define HAVE_ISINF} +//#define isinf(n) (!_finite(n)) + +//#define gettid() ((tid_t)GetCurrentThreadId()) + +{$endif} { WIN32 } + diff --git a/httpd/mod_hello.lpi b/httpd/mod_hello.lpi index 45d6e4e18..dabc0d424 100644 --- a/httpd/mod_hello.lpi +++ b/httpd/mod_hello.lpi @@ -7,710 +7,27 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -724,7 +41,925 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -733,8 +968,8 @@ - - + + diff --git a/httpd/mod_hello.lpr b/httpd/mod_hello.lpr index 0e7eb1366..3c09437c9 100644 --- a/httpd/mod_hello.lpr +++ b/httpd/mod_hello.lpr @@ -15,7 +15,7 @@ library mod_hello; {$DEFINE WINDOWS} {$ENDIF} -{$define Apache2_2} // Change when recompiling to a different Apache version +{$define Apache1_3} // Change when recompiling to a different Apache version uses SysUtils, httpd {$ifndef Apache1_3}, apr{$endif};